package cn.source.web.controller.tool;

import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import cn.source.common.config.RuoYiConfig;
import cn.source.common.core.domain.AjaxResult;
import cn.source.common.core.domain.entity.SysDictData;
import cn.source.common.core.page.TableDataInfo;
import cn.source.common.core.redis.RedisCache;
import cn.source.common.utils.StringUtils;
import cn.source.majors.domain.SMajors;
import cn.source.majors.service.ISMajorsService;
import cn.source.school.domain.School;
import cn.source.school.domain.SchoolsmajorsDetail;
import cn.source.school.service.ISchoolService;
import cn.source.subject.domain.SMajorsSubjectVo;
import cn.source.subject.domain.SmSubject;
import cn.source.subject.domain.SubjectselectschoolVo;
import cn.source.subject.service.ISmSubjectService;
import cn.source.system.domain.*;
import cn.source.system.service.*;
import io.swagger.annotations.ApiOperation;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.web.bind.annotation.*;


import com.ruoyi.sms.manager.ISmsManager;

import java.io.*;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;

import cn.hutool.core.util.IdUtil;
import cn.hutool.core.date.DateUtil;
import cn.source.common.annotation.Log;
import cn.source.common.core.controller.BaseController;
import io.swagger.annotations.Api;

import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@CrossOrigin(origins = "*",maxAge = 3600)
@Api("API接口")
@RestController
@RequestMapping("/api")
@EnableAsync
public class ApiController extends BaseController {

    //今年招生计划,每年5月底公布录取指南后，修改去年的招生计划年份为当年
	private Integer thisYear=2025;

	//年度分数线，每年20日出了分数线后再改
	private Integer gradeLineYear=2024;

	private Integer thisYearLgGradeLine=371;
	private Integer thisYearLgGxpm=161047;
	private Integer thisYearLgQgpm=160890;
	private Integer thisYearWsGradeLine=400;
	private Integer thisYearWsGxpm=52206;
	private Integer thisYearWsQgpm=52139;
	/*
	private int gradeLineLg2024=371;
	private int gradeLineLg2023=347;
	private int gradeLineLg2022=343;
	private int gradeLineLg2021=348;
	private int gradeLineLg2020=353;
	
	private int gradeLineWs2024=400;
	private int gradeLineWs2023=428;
	private int gradeLineWs2022=421;
	private int gradeLineWs2021=413;
	private int gradeLineWs2020=381;
	*/
	
	/*近3年本科录取分数线*/
	private int gradeLineLg2022=371;
	private int gradeLineLg2021=347;
	private int gradeLineLg2020=343;
	
	private int gradeLineWs2022=400;
	private int gradeLineWs2021=428;
	private int gradeLineWs2020=421;
	
	//专科
	/*
	private int gradeLineLg2022=200;
	private int gradeLineLg2021=180;
	private int gradeLineLg2020=180;
	
	private int gradeLineWs2022=200;
	private int gradeLineWs2021=181;
	private int gradeLineWs2020=181;
	*/

    //近3年
	private int yearNew1=2024;
	private int yearNew2=2023;
	private int yearNew3=2022;

	private boolean free=true;

    @Autowired
    private ISchoolService schoolService;

    @Autowired
    private ISMajorsService sMajorsService;

    @Autowired
    private ISmSubjectService smSubjectService;

    @Autowired
    private ISysDictTypeService dictTypeService;

    @Autowired
    private IBaseAreaService baseAreaService;
    
    @Autowired
    private IBuzMemberService buzMemberService;
    
    @Autowired
    private IYxSmsService tSmsService;
    
    @Autowired
    private ISmsManager smsManager;
    
    @Autowired
	private SendSmsDemo sendSmsDemo;

    
    @Autowired
    private ISchoolPlanService schoolPlanService;
    
    @Autowired
    private ISchoolMajorYearAdmissionService schoolMajorYearAdmissionService;
    
    @Autowired
    private ISchoolMajorYearAdmissionDetailService schoolMajorYearAdmissionDetailService;
    
    @Autowired
    private IGkGradeDocService gkGradeDocService;
    
    @Autowired
    private IMyFavoriteService myFavoriteService;

	@Autowired
	private IGkZytbService gkZytbService;

	@Autowired
	private IGkZytbDetailService gkZytbDetailService;

    @Autowired
    private ISysNoticeService noticeService;

    @Autowired
    private IGkCardService gkCardService;

    @Autowired
    IGkMemberSettingService gkMemberSettingService;

	@Autowired
	private RedisCache redisCache;

    @Autowired
    IBuzMemberGradeService buzMemberGradeService;

	@Autowired
	IVipPriceService vipPriceService;

	@Autowired
	ISchoolZyzYearAdmissionService schoolZyzYearAdmissionService;


    
    /**
     * 判断是否含有特殊字符
     *
     * @param str
     * @return true为包含，false为不包含
     */
    public static boolean isSpecialChar(String str) {
        String regEx = "[ _`~!#$%^&*()+=|{}&':;',\\[\\]<>/?~！#￥%……&*（）——+|{}【】‘；：”“’。，、？]|\n|\r|\t";
        Pattern p = Pattern.compile(regEx);
        Matcher m = p.matcher(str);
        return m.find();
    }
    
    
  //效验  
    protected static boolean sqlValidate(String str) {  
        str = str.toLowerCase();//统一转为小写  
        String badStr = "'|select|update|and|or|delete|insert|truncate|char|into"
        		+ "|substr|declare|exec|master|drop|execute|sleep|"
        		+ "union|;|--|+|,|like|//|/|%|#|*|$|\"|http|cr|lf|<|>|(|)";//过滤掉的sql关键字，可以手动添加  
        String[] badStrs = badStr.split("\\|");  
        for (int i = 0; i < badStrs.length; i++) {  
            if (str.indexOf(badStrs[i]) >= 0) {  
                return true;  
            }  
        }  
        return false;  
    } 
    
    
    
    
    /**京东云短信接口*/
    //@Autowired
	//private SmsSender smsSender;

    @ApiOperation("获取学校列表")
    @GetMapping("/school/school/list")
    public TableDataInfo list(School school)
    {
        startPage();
        List<School> list = schoolService.selectSchoolList(school);
        return getDataTable(list);
    }
    
    @ApiOperation("获取学校列表")
    @GetMapping("/schoolListByProvince")
    public AjaxResult schoolListByProvince(Long province,String userId,String schoolType,String schoolLevel)
    {
    	
    	School school=new School();

		if(province!=null) {
			school.setSprovince(province);
		}

		if(StrUtil.isNotEmpty(schoolType)) {
			if(isSpecialChar(schoolType.toString())||sqlValidate(schoolType.toString())){
				AjaxResult.error("参数包含非法字符");
			}
			school.setStypes(schoolType);
		}

		if(StrUtil.isNotEmpty(schoolLevel)) {
			if(isSpecialChar(schoolLevel.toString())||sqlValidate(schoolLevel.toString())){
				AjaxResult.error("参数包含非法字符");
			}
			school.setCollegeLevel(schoolLevel);
		}

    	
    	if(userId!=null&&!userId.trim().equals("")) {
    		if(isSpecialChar(userId.toString())||sqlValidate(userId.toString())){
        		AjaxResult.error("参数包含非法字符");
        	}
    		
    		BuzMember memberQuery=buzMemberService.selectBuzMemberById(userId);
    		
    		if("物理".equals(memberQuery.getSxkm())) {
    			school.setMajorType("理工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		school.setMajorType("文史类");
        	}
    	}


    	
    	List<School> list = schoolService.selectSchoolListBy2024(school);
        return AjaxResult.success(list);
    }

    @ApiOperation("获取通知列表")
    @GetMapping("/noticeList")
    public AjaxResult noticeList()
    {


        List<SysNotice> list = noticeService.selectNoticeList(null);
        return AjaxResult.success(list);
    }


    @ApiOperation("科目选专业")
    @RequestMapping ("/subject/select/major")
    public TableDataInfo subjecMajortlist(@RequestBody SubjectselectschoolVo subject){

       startPage();
        List<SubjectselectschoolVo> list = smSubjectService.selectSubjectMajorList(subject);
        return getDataTable(list);
    }

	@ApiOperation("根据用户ID，查询改用户可选择专业")
	@GetMapping("/queryUserMajor")
	public AjaxResult queryUserMajor(String userId,String majorName,Integer pageNum,String menuFor){

		if(StrUtil.isEmpty(userId)) {
			return AjaxResult.error("请先登录");
		}

		if (isSpecialChar(userId.toString()) || sqlValidate(userId.toString())) {
			AjaxResult.error("参数包含非法字符");
		}

		BuzMember memberQuery = buzMemberService.selectBuzMemberById(userId);

		if (memberQuery != null && memberQuery.getPhone() != null) {

		} else {

			return AjaxResult.error("会员信息不存在，请先注册成为会员");
		}

		if (memberQuery.getSfvip().intValue() == 0) {
			return AjaxResult.error("请先升级为VIP会员");
		}

		if(pageNum==null||pageNum.intValue()==0) pageNum=1;
		int pageRow=(pageNum-1)*50;



		if(memberQuery.getSxkm()!=null&&memberQuery.getGrade()!=null) {
			SchoolPlan schoolPlanQuery=new SchoolPlan();
			schoolPlanQuery.setYear(thisYear);
			if("物理".equals(memberQuery.getSxkm())) {
				schoolPlanQuery.setMajorType("理工类");
			}
			if("历史".equals(memberQuery.getSxkm())) {
				schoolPlanQuery.setMajorType("文史类");
			}

			if(majorName!=null&&!majorName.equals("")){
				if (isSpecialChar(majorName.toString()) || sqlValidate(majorName.toString())) {
					AjaxResult.error("参数包含非法字符");
				}
				schoolPlanQuery.setMajorName(majorName);
			}
			schoolPlanQuery.setMajorPlan(memberQuery.getGrade());
			schoolPlanQuery.setPageNum(pageRow);
			if(menuFor!=null&&!menuFor.equals("")){
				if (isSpecialChar(menuFor.toString()) || sqlValidate(menuFor.toString())) {
					AjaxResult.error("参数包含非法字符");
				}
				schoolPlanQuery.setSchoolPm(1L);
				schoolPlanQuery.setMajorSeq(userId);
			}
			List<SchoolPlan> plans2024List =schoolPlanService.selectSchoolMajorNameList(schoolPlanQuery);
			return AjaxResult.success(plans2024List);
		}

		return AjaxResult.success();
	}

    @ApiOperation("院校选专业")
    @GetMapping("/school/select/major")
    public TableDataInfo schoolMajortlist(@RequestBody School scode){

        startPage();
        List<School> list = schoolService.selectschoolMajorList(scode);
        return getDataTable(list);
    }

	@ApiOperation("根据专业名称获取专业详情")
	@GetMapping("/getZyDetailByName")
	public AjaxResult getZyDetailByName(String zy){

		SMajors majors=new SMajors();
		majors.setMname(zy);
		List<SMajors> list=sMajorsService.selectSMajorsListByName(majors);
		if(list!=null&&list.size()>0){
			return AjaxResult.success(list.get(0));
		}

		return AjaxResult.error();
	}

	/**
	 *
	 * @param priceClass   vip 和 export
	 * @return
	 */
	@ApiOperation("获取VIP价格")
	@GetMapping("/getVipPrice")
	public AjaxResult getVipPrice(String priceClass){


		if(priceClass==null||priceClass.equals("")) {

			return AjaxResult.error("价格类型不能为空");
		}

		if(isSpecialChar(priceClass.toString())||sqlValidate(priceClass.toString())){
			AjaxResult.error("参数包含非法字符");
		}

		VipPrice price=new VipPrice();
		price.setPriceClass(priceClass);
		List<VipPrice> list=vipPriceService.selectVipPriceList(price);
		if(list!=null&&list.size()>0){
			return AjaxResult.success(list.get(0));
		}

		return AjaxResult.error();
	}

	@ApiOperation("院校选专业组")
	@GetMapping("/zyzListBySchoolCode")
	public AjaxResult zyzListBySchoolCode(String scode,String userId){

		if(userId==null||userId.equals("")) {
			//userId="1786281642017542144";
			return AjaxResult.error("请先登录");
		}

		if(isSpecialChar(userId.toString())||sqlValidate(userId.toString())){
			AjaxResult.error("参数包含非法字符");
		}

		BuzMember memberQuery=buzMemberService.selectBuzMemberById(userId);

		if(memberQuery!=null&&memberQuery.getPhone()!=null) {

		}else {

			return AjaxResult.error("会员信息不存在，请先注册成为会员");
		}

		SchoolPlan schoolPlanQuery=new SchoolPlan();
		schoolPlanQuery.setYear(thisYear);
		schoolPlanQuery.setSchoolCode(scode);
		if("物理".equals(memberQuery.getSxkm())) {
			schoolPlanQuery.setMajorType("理工类");
		}
		if("历史".equals(memberQuery.getSxkm())) {
			schoolPlanQuery.setMajorType("文史类");
		}

		//如果会员不是少数民族，则不能查询民族班
		if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
			schoolPlanQuery.setSsmzFlag(0);
		}

		if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
			schoolPlanQuery.setGjzxFlag(0);
		}

		if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
			schoolPlanQuery.setGxzxFlag(0);
		}

		//考生的再选科目
		schoolPlanQuery.setZxkm(memberQuery.getZxkm());

		Map map=new HashMap();
		//根据学校编码，查询学校信息
		List<School> schoolList=schoolService.selectByScodeschool(scode);
		if(schoolList!=null){
			School school=schoolList.get(0);
			map.put("school",school);
		}

		List<SchoolPlan> zyzList =schoolPlanService.selectSchoolZyzPlanList(schoolPlanQuery);
		map.put("zyzList",zyzList);

		return AjaxResult.success(map);
	}

	@ApiOperation("院校选专业组")
	@GetMapping("/zyListBySchoolCodeZyz")
	public AjaxResult zyListBySchoolCodeZyz(String zyz,String scode,String userId){

		if(userId==null||userId.equals("")) {
			//userId="1786281642017542144";
			return AjaxResult.error("请先登录");
		}

		if(isSpecialChar(userId.toString())||sqlValidate(userId.toString())){
			AjaxResult.error("参数包含非法字符");
		}

		BuzMember memberQuery=buzMemberService.selectBuzMemberById(userId);

		if(memberQuery!=null&&memberQuery.getPhone()!=null) {

		}else {

			return AjaxResult.error("会员信息不存在，请先注册成为会员");
		}

		SchoolPlan schoolPlanQuery=new SchoolPlan();
		schoolPlanQuery.setYear(thisYear);
		schoolPlanQuery.setSchoolCode(scode);
		schoolPlanQuery.setZyz(zyz);
		if("物理".equals(memberQuery.getSxkm())) {
			schoolPlanQuery.setMajorType("理工类");
		}
		if("历史".equals(memberQuery.getSxkm())) {
			schoolPlanQuery.setMajorType("文史类");
		}

		//如果会员不是少数民族，则不能查询民族班
		if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
			schoolPlanQuery.setSsmzFlag(0);
		}

		if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
			schoolPlanQuery.setGjzxFlag(0);
		}

		if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
			schoolPlanQuery.setGxzxFlag(0);
		}

		//考生的再选科目
		schoolPlanQuery.setZxkm(memberQuery.getZxkm());

		//下拉可选专业
		List<SchoolPlan> zyzList =schoolPlanService.selectSchoolMajorPlanList(schoolPlanQuery);

		Map map=new HashMap();

		/***
		 * 获取专业组的招生计划、投档概率
		 */
		//招生计划
		List<SchoolPlan> plans2023List =schoolPlanService.selectSchoolZyz2023PlanList(schoolPlanQuery);
		int totalPlan=0;
		if(plans2023List!=null&&plans2023List.size()>0){
			for(int i=0;i<plans2023List.size();i++){
				SchoolPlan schoolPlan=plans2023List.get(i);
				int plan=schoolPlan.getMajorPlan();
				totalPlan=totalPlan+plan;
			}
		}
		//计算专业组的投档概率
		//根据学校编码，查询学校信息
		School school =null;
		List<School> schoolList=schoolService.selectByScodeschool(scode);
		if(schoolList!=null) {
			school = schoolList.get(0);
		}


		boolean qgjfFlag=true;//是否认可全国加分
		if(school.getRemark()!=null) {
			if(school.getRemark().indexOf("不认可加分")>-1) {//该学校不认可加分，则全国分只取高考分
				qgjfFlag=false;
			}
		}

		String provinceName=school.getProvinceName();


		String schoolCode="'"+scode+"'";

		//查询专业组
		schoolPlanQuery=new SchoolPlan();
		schoolPlanQuery.setYear(thisYear);
		schoolPlanQuery.setSchoolCode(schoolCode);
		if("物理".equals(memberQuery.getSxkm())) {
			schoolPlanQuery.setMajorType("理工类");
		}
		if("历史".equals(memberQuery.getSxkm())) {
			schoolPlanQuery.setMajorType("文史类");
		}

		schoolPlanQuery.setZyz(zyz);
		List<SchoolPlan> plans2024List =schoolPlanService.selectSchoolZyz2024PlanList(schoolPlanQuery);


		//专业组投档概率
		List<School> returnList =new ArrayList();


		DecimalFormat df = new DecimalFormat("#.00");
		//开始计算专业组投档率
		if(plans2024List!=null&&plans2024List.size()>0) {
			SchoolPlan plan2024=plans2024List.get(0);
			//最低录取分数线
			int grade = plan2024.getGrade();
			int memberGrade = memberQuery.getGrade();

			//double finalRate = (memberGrade - grade) / 2 + 50;


			float cha= (float)(memberGrade - grade) / 2;
			if(cha>0) cha=cha+1;
			if(cha<0) cha=cha-1;
			double finalRate = cha + 50;


			if (finalRate >= 100) finalRate = 99.99;
			if (finalRate < 1) finalRate = 1;


			map.put("submitRate", finalRate);

		}else{
			map.put("submitRate", "-");
		}


		map.put("zyzList",zyzList);
		map.put("totalPlan",totalPlan);

		return AjaxResult.success(map);
	}

    /**
	 *
     * @param zyz
     * @param scode
     * @param userId
     * @param zyId 志愿ID
     * @param pcId 批次ID
     * @return
     */
	@ApiOperation("根据院校、专业组查询改专业组下的专业，含投档概率")
	@GetMapping("/zyListBySchoolCodeZyzSubmit")
	public AjaxResult zyListBySchoolCodeZyzSubmit(String zyz,String scode,String userId,String zyId,String pcId){

		if(userId==null||userId.equals("")) {
			return AjaxResult.error("请先登录");
		}


		if(isSpecialChar(userId.toString())||sqlValidate(userId.toString())){
			AjaxResult.error("参数包含非法字符");
		}

        if(zyId==null||zyId.equals("")) {
            return AjaxResult.error("志愿ID为空");
        }

        if(pcId==null||pcId.equals("")) {
            return AjaxResult.error("批次ID为空");
        }

		BuzMember memberQuery=buzMemberService.selectBuzMemberById(userId);

		if(memberQuery!=null&&memberQuery.getPhone()!=null) {

		}else {

			return AjaxResult.error("会员信息不存在，请先注册成为会员");
		}



		//查找会员的同位分
		BuzMemberGrade memberGradeQuery=new BuzMemberGrade();
		memberGradeQuery.setMemberId(memberQuery.getId());
		List<BuzMemberGrade> memberGradeList=buzMemberGradeService.selectBuzMemberGradeList(memberGradeQuery);


		SchoolPlan schoolPlanQuery=new SchoolPlan();
		schoolPlanQuery.setYear(thisYear);
		schoolPlanQuery.setSchoolCode(scode);
		schoolPlanQuery.setZyz(zyz);
		if("物理".equals(memberQuery.getSxkm())) {
			schoolPlanQuery.setMajorType("理工类");
		}
		if("历史".equals(memberQuery.getSxkm())) {
			schoolPlanQuery.setMajorType("文史类");
		}

		//如果会员不是少数民族，则不能查询民族班
		if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
			schoolPlanQuery.setSsmzFlag(0);
		}

		if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
			schoolPlanQuery.setGjzxFlag(0);
		}

		if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
			schoolPlanQuery.setGxzxFlag(0);
		}

		//考生的再选科目
		schoolPlanQuery.setZxkm(memberQuery.getZxkm());

		//根据学校、专业组查询 所有的专业
		List<SchoolPlan> zyzList =schoolPlanService.selectSchoolMajorPlanList(schoolPlanQuery);

		//查找近3年该学校、专业组下各专业的录取数据
		//需要查找每个专业近3年的数据
		String zyCode="";//列表中所有的专业编码
		if(zyzList!=null&&zyzList.size()>0) {
			for(int i=0;i<zyzList.size();i++) {
				SchoolPlan school=zyzList.get(i);
				zyCode=zyCode+"'"+school.getMajorCode()+"',";
			}
			zyCode=zyCode.substring(0,zyCode.length()-1);
		}
		schoolPlanQuery.setYear3(yearNew1+","+yearNew2+","+yearNew3);
		schoolPlanQuery.setMajorName(zyCode);
		List<SchoolPlan> majorList =schoolPlanService.selectSchoolMajorList3Year(schoolPlanQuery);

		Map map=new HashMap();

        map.put("zyId",zyId);
        map.put("pcId",pcId);

		/***
		 * 获取专业组的招生计划、投档概率
		 */
		//招生计划
		int totalPlan=0;

		//计算专业组的投档概率
		//根据学校编码，查询学校信息
		School school =null;
		List<School> schoolList=schoolService.selectByScodeschool(scode);
		if(schoolList!=null) {
			school = schoolList.get(0);
			school.setZyz(zyz);
		}

		map.put("school",school);





		String schoolCode="'"+scode+"'";

		//查询专业组
		schoolPlanQuery=new SchoolPlan();
		schoolPlanQuery.setYear(thisYear);
		schoolPlanQuery.setSchoolCode(schoolCode);
		if("物理".equals(memberQuery.getSxkm())) {
			schoolPlanQuery.setMajorType("理工类");
		}
		if("历史".equals(memberQuery.getSxkm())) {
			schoolPlanQuery.setMajorType("文史类");
		}

		schoolPlanQuery.setZyz(zyz);
		List<SchoolPlan> plans2024List =schoolPlanService.selectSchoolZyz2024PlanList(schoolPlanQuery);



		DecimalFormat df = new DecimalFormat("#.00");

		String provinceName=school.getProvinceName();
		//开始计算专业组投档率
		if(plans2024List!=null&&plans2024List.size()>0) {
			SchoolPlan plan2024=plans2024List.get(0);
			//最低录取分数线
			int grade2024 = plan2024.getGrade();

			//专业组投档概率
			float zyzAdminssRate=0;

			/**
			 * 需要判断该专业的学校是省内还是省外，确定用广西分还是全国分
			 */
			/*
			if(provinceName!=null) {
				if(provinceName.equals("广西")) {
					Integer cha = memberQuery.getGxgrade() - grade2024;
					zyzAdminssRate = cha.intValue() / 2 + 50;
				}else{
					Integer cha = memberQuery.getQggrade() - grade2024;
					zyzAdminssRate = cha.intValue() / 2 + 50;
				}
			}

			 */
			if(memberQuery.getGxgrade().intValue()==grade2024){
				zyzAdminssRate=50;
			}else{
				float cha = new Float((memberQuery.getGxgrade() - grade2024)/ 2);
				if(cha<0){
					zyzAdminssRate=cha-1+50;
				}else{
					zyzAdminssRate=cha+1+50;
				}
			}

			if(zyzAdminssRate>=100) zyzAdminssRate=99;
			if(zyzAdminssRate<1) zyzAdminssRate=1;


			map.put("zyzSubmitRate", df.format(zyzAdminssRate)+"%");

		}else{
			map.put("zyzSubmitRate", "-");
		}


		//考生近3年的广西排位
		int gxj2022=0;
		int gxj2021=0;
		int gxj2020=0;
		//考生近3年全国排位分
		int qgj2022=0;
		int qgj2021=0;
		int qgj2020=0;
		/**
		 * 计算当年的排名和对应的分数
		 */
		if (provinceName.equals("广西")) {
			if (memberGradeList != null && memberGradeList.size() > 0) {
				for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
					BuzMemberGrade memberGrade = memberGradeList.get(k1);
					if (memberGrade.getYear().intValue() == yearNew1) {
						if (memberGrade.getPmGradeGx() != null) {
							gxj2022=memberGrade.getPmGradeGx();
						}
					}
					if (memberGrade.getYear().intValue() == yearNew2) {
						if (memberGrade.getPmGradeGx() != null) {
							gxj2021=memberGrade.getPmGradeGx();
						}
					}
					if (memberGrade.getYear().intValue() == yearNew3) {
						if (memberGrade.getPmGradeGx() != null) {
							gxj2020=memberGrade.getPmGradeGx();
						}
					}
				}
			}
		} else {
			if (memberGradeList != null && memberGradeList.size() > 0) {
				for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
					BuzMemberGrade memberGrade = memberGradeList.get(k1);
					if (memberGrade.getYear().intValue() == yearNew1) {
						if (memberGrade.getPmGradeGx() != null) {
							qgj2022=memberGrade.getPmGrade();
						}
					}
					if (memberGrade.getYear().intValue() == yearNew2) {
						if (memberGrade.getPmGradeGx() != null) {
							qgj2021=memberGrade.getPmGrade();
						}
					}
					if (memberGrade.getYear().intValue() == yearNew3) {
						if (memberGrade.getPmGradeGx() != null) {
							qgj2020=memberGrade.getPmGrade();
						}
					}
				}
			}
		}


		for(int i=0;i< zyzList.size();i++) {
			SchoolPlan zyzPlan=zyzList.get(i);

			Integer majorPlan=zyzPlan.getMajorPlan();
			if(majorPlan==null) majorPlan=0;
			totalPlan=totalPlan+majorPlan;


			int zyavgGrade2022=0;
			int zyminGrade2022=0;
			int zyavgGrade2021=0;
			int zyminGrade2021=0;
			int zyavgGrade2020=0;
			int zyminGrade2020=0;


			double zySubmitRate=0;
			double finalZySubmitRate=0;

			//近3年的专业数据
			for(int k=0;k<majorList.size();k++) {
				SchoolPlan schoolPlan = majorList.get(k);
				if (zyzPlan.getSchoolCode().equals(schoolPlan.getSchoolCode()) &&
						schoolPlan.getZyz().equals(zyzPlan.getZyz()) &&
						zyzPlan.getMajorCode().equals(schoolPlan.getMajorCode())) {

					if (schoolPlan.getYear().intValue() == yearNew1) {
						if (schoolPlan.getMajorAvgGrade() != null) {
							zyavgGrade2022 = schoolPlan.getMajorAvgGrade();
							zyminGrade2022=schoolPlan.getMajorLowGrade();
						}
					}

					if (schoolPlan.getYear().intValue() == yearNew2) {
						if (schoolPlan.getMajorAvgGrade() != null) {
							zyavgGrade2021 = schoolPlan.getMajorAvgGrade();
							zyminGrade2021=schoolPlan.getMajorLowGrade();
						}
					}

					if (schoolPlan.getYear().intValue() == yearNew3) {
						if (schoolPlan.getMajorAvgGrade() != null) {
							zyavgGrade2020 = schoolPlan.getMajorAvgGrade();
							zyminGrade2020=schoolPlan.getMajorLowGrade();
						}
					}

					if(provinceName.equals("广西")) {
						int memberGxGrade=memberQuery.getGxgrade();
						int yearLowGrade=zyminGrade2022;
						if(yearLowGrade==0)	yearLowGrade=zyminGrade2021;
						if(yearLowGrade==0)	yearLowGrade=zyminGrade2020;
						if(memberGxGrade==yearLowGrade){
							zySubmitRate =50;
						}else{
							float cha=(float)(memberGxGrade-yearLowGrade)/2;
							if(cha<0){
								cha=cha-1+50;
							}else{
								cha=cha+1+50;
							}
							if(cha>=100) cha=99.99f;
							if(cha<1) cha=1;
							zySubmitRate =cha;
						}
					}else{
						int memberGxGrade=memberQuery.getGxgrade();
						int yearLowGrade=zyminGrade2022;
						if(yearLowGrade==0)	yearLowGrade=zyminGrade2021;
						if(yearLowGrade==0)	yearLowGrade=zyminGrade2020;
						if(memberGxGrade==yearLowGrade){
							zySubmitRate =50;
						}else{
							float cha=(float)(memberGxGrade-yearLowGrade)/2;
							if(cha<0){
								cha=cha-1+50;
							}else{
								cha=cha+1+50;
							}
							if(cha>=100) cha=99.99f;
							if(cha<1) cha=1;
							zySubmitRate =cha;
						}
					}
					zyzPlan.setZySubmitRate(df.format(zySubmitRate));//专业投档概率

					/*
					if (zyavgGrade2020 > 0 && zyavgGrade2021 > 0 && zyavgGrade2022 > 0) {//3年都有数据
						if (provinceName.equals("广西")) {
							if (gxj2020 - zyavgGrade2020 > 0 && gxj2021 - zyavgGrade2021 > 0 && gxj2022 - zyavgGrade2022 > 0) {//3年的同位分都比录取平均分高
								double rate = ((gxj2022 - zyavgGrade2022) / 2 + 80) * 0.55 + ((gxj2021 - zyavgGrade2021) / 2 + 80) * 0.3 + ((gxj2020 - zyavgGrade2020) / 2 + 80) * 0.15;


								if (rate >= 100) rate = 99.99;
								if (rate < 1) rate = 1;
								zySubmitRate = rate;
							} else {
								double rate = 0;
								//2年高于
								int count = 0;
								if (gxj2022 - zyavgGrade2022 > 0) {
									count++;
								}
								if (gxj2021 - zyavgGrade2021 > 0) {
									count++;
								}
								if (gxj2020 - zyavgGrade2020 > 0) {
									count++;
								}
								if (count == 2) {//有2年高于同位分的

									if (gxj2022 - zyavgGrade2022 > 0) {
										rate = rate + ((gxj2022 - zyavgGrade2022) / 2 + 70) * 0.55;
									} else {
										rate = rate + ((gxj2022 - zyminGrade2022) / 2 + 50) * 0.55;
									}

									if (gxj2021 - zyavgGrade2021 > 0) {
										rate = rate + ((gxj2021 - zyavgGrade2021) / 2 + 70) * 0.3;
									} else {
										rate = rate + ((gxj2021 - zyminGrade2021) / 2 + 50) * 0.3;
									}

									if (gxj2020 - zyavgGrade2020 > 0) {
										rate = rate + ((gxj2020 - zyavgGrade2020) / 2 + 70) * 0.15;
									} else {
										rate = rate + ((gxj2020 - zyminGrade2020) / 2 + 50) * 0.15;
									}
								} else if (count == 1) {//有1年高于同位分的

									if (gxj2022 - zyavgGrade2022 > 0) {
										rate = rate + ((gxj2022 - zyavgGrade2022) / 2 + 60) * 0.55;
									} else {
										rate = rate + ((gxj2022 - zyminGrade2022) / 2 + 50) * 0.55;
									}

									if (gxj2021 - zyavgGrade2021 > 0) {
										rate = rate + ((gxj2021 - zyavgGrade2021) / 2 + 60) * 0.3;
									} else {
										rate = rate + ((gxj2021 - zyminGrade2021) / 2 + 50) * 0.3;
									}

									if (gxj2020 - zyavgGrade2020 > 0) {
										rate = rate + ((gxj2020 - zyavgGrade2020) / 2 + 60) * 0.15;
									} else {
										rate = rate + ((gxj2020 - zyminGrade2020) / 2 + 50) * 0.15;
									}

								} else {//一个高于的都没有
									rate = ((gxj2022 - zyminGrade2022) / 2 + 50) * 0.55 + ((gxj2021 - zyminGrade2021) / 2 + 50) * 0.3 + ((gxj2020 - zyminGrade2020) / 2 + 50) * 0.15;
								}


								if (rate >= 100) rate = 99.99;
								if (rate < 1) rate = 1;
								zySubmitRate = rate;
							}
						} else {//全国学校，用全国同位分
							if (qgj2020 - zyavgGrade2020 > 0 && qgj2021 - zyavgGrade2021 > 0 && qgj2022 - zyavgGrade2022 > 0) {//3年的同位分都比录取平均分高
								double rate = ((qgj2022 - zyavgGrade2022) / 2 + 80) * 0.55 + ((qgj2021 - zyavgGrade2021) / 2 + 80) * 0.3 + ((qgj2020 - zyavgGrade2020) / 2 + 80) * 0.15;

								if (rate >= 100) rate = 99.99;
								if (rate < 1) rate = 1;
								zySubmitRate = rate;
							} else {
								double rate = 0;
								//2年高于
								int count = 0;
								if (qgj2022 - zyavgGrade2022 > 0) {
									count++;
								}
								if (qgj2021 - zyavgGrade2021 > 0) {
									count++;
								}
								if (qgj2020 - zyavgGrade2020 > 0) {
									count++;
								}
								if (count == 2) {//有2年高于同位分的

									if (qgj2022 - zyavgGrade2022 > 0) {
										rate = rate + ((qgj2022 - zyavgGrade2022) / 2 + 70) * 0.55;
									} else {
										rate = rate + ((qgj2022 - zyminGrade2022) / 2 + 50) * 0.55;
									}

									if (qgj2021 - zyavgGrade2021 > 0) {
										rate = rate + ((qgj2021 - zyavgGrade2021) / 2 + 70) * 0.3;
									} else {
										rate = rate + ((qgj2021 - zyminGrade2021) / 2 + 50) * 0.3;
									}

									if (qgj2020 - zyavgGrade2020 > 0) {
										rate = rate + ((qgj2020 - zyavgGrade2020) / 2 + 70) * 0.15;
									} else {
										rate = rate + ((qgj2020 - zyminGrade2020) / 2 + 50) * 0.15;
									}
								} else if (count == 1) {//有1年高于同位分的

									if (qgj2022 - zyavgGrade2022 > 0) {
										rate = rate + ((qgj2022 - zyavgGrade2022) / 2 + 60) * 0.55;
									} else {
										rate = rate + ((qgj2022 - zyminGrade2022) / 2 + 50) * 0.55;
									}

									if (qgj2021 - zyavgGrade2021 > 0) {
										rate = rate + ((qgj2021 - zyavgGrade2021) / 2 + 60) * 0.3;
									} else {
										rate = rate + ((qgj2021 - zyminGrade2021) / 2 + 50) * 0.3;
									}

									if (qgj2020 - zyavgGrade2020 > 0) {
										rate = rate + ((qgj2020 - zyavgGrade2020) / 2 + 60) * 0.15;
									} else {
										rate = rate + ((qgj2020 - zyminGrade2020) / 2 + 50) * 0.15;
									}

								} else {//一个高于的都没有
									rate = ((qgj2022 - zyminGrade2022) / 2 + 50) * 0.55 + ((qgj2021 - zyminGrade2021) / 2 + 50) * 0.3 + ((qgj2020 - zyminGrade2020) / 2 + 50) * 0.15;
								}


								if (rate >= 100) rate = 99.99;
								if (rate < 1) rate = 1;
								zySubmitRate = rate;
							}
						}
					} else {//数据不满3年
						int years = 0;
						if (zyavgGrade2020 > 0) years++;
						if (zyavgGrade2021 > 0) years++;
						if (zyavgGrade2022 > 0) years++;
						if (years == 2) {
							double rate = 0;
							if (provinceName.equals("广西")) {
								int heightYears = 0;//这两年中，同位分大于平均分的年份数=2，则+70，如果年份数=1，则+60，都不大于平均分，则+50
								if (zyavgGrade2022 > 0 && gxj2022 - zyavgGrade2022 > 0) heightYears++;
								if (zyavgGrade2021 > 0 && gxj2021 - zyavgGrade2021 > 0) heightYears++;
								if (zyavgGrade2020 > 0 && gxj2020 - zyavgGrade2020 > 0) heightYears++;

								if (zyavgGrade2022 > 0) {//2022年有数据
									if (heightYears == 2) {
										double rate1 = ((gxj2022 - zyavgGrade2022) / 2 + 70) * 0.60;
										rate = rate + rate1;

										if (zyavgGrade2021 > 0) {
											double rate2 = ((gxj2021 - zyavgGrade2021) / 2 + 70) * 0.40;
											rate = rate + rate2;
										} else {
											double rate2 = ((gxj2020 - zyavgGrade2020) / 2 + 70) * 0.40;
											rate = rate + rate2;
										}
									} else if (heightYears == 1) {
										if (gxj2022 - zyavgGrade2022 > 0) {
											double rate1 = ((gxj2022 - zyavgGrade2022) / 2 + 60) * 0.60;
											rate = rate + rate1;
										} else {
											double rate1 = ((gxj2022 - zyminGrade2022) / 2 + 50) * 0.60;
											rate = rate + rate1;
										}
										if (zyavgGrade2021 > 0) {
											if (gxj2021 - zyavgGrade2021 > 0) {
												double rate1 = ((gxj2021 - zyavgGrade2021) / 2 + 60) * 0.40;
												rate = rate + rate1;
											} else {
												double rate1 = ((gxj2021 - zyminGrade2021) / 2 + 60) * 0.40;
												rate = rate + rate1;
											}
										} else {
											if (gxj2020 - zyavgGrade2020 > 0) {
												double rate1 = ((gxj2020 - zyavgGrade2020) / 2 + 60) * 0.40;
												rate = rate + rate1;
											} else {
												double rate1 = ((gxj2020 - zyminGrade2020) / 2 + 60) * 0.40;
												rate = rate + rate1;
											}
										}
									} else {//都不高于平均分
										double rate1 = ((gxj2022 - zyminGrade2022) / 2 + 50) * 0.60;
										rate = rate + rate1;
										if (zyavgGrade2021 > 0) {
											double rate2 = ((gxj2021 - zyminGrade2021) / 2 + 50) * 0.60;
											rate = rate + rate2;
										} else {
											double rate2 = ((gxj2020 - zyminGrade2020) / 2 + 50) * 0.40;
											rate = rate + rate2;
										}
									}
								} else {//2022年没数据，只有2021和2020年数据
									if (heightYears == 2) {
										double rate1 = ((gxj2021 - zyavgGrade2021) / 2 + 70) * 0.60 + ((gxj2020 - zyavgGrade2020) / 2 + 70) * 0.40;
										rate = rate + rate1;
									} else if (heightYears == 1) {
										if (gxj2021 - zyavgGrade2021 > 0) {
											double rate1 = ((gxj2021 - zyavgGrade2021) / 2 + 60) * 0.60;
											rate = rate + rate1;
										} else {
											double rate1 = ((gxj2021 - zyminGrade2021) / 2 + 50) * 0.60;
											rate = rate + rate1;
										}
										if (gxj2020 - zyavgGrade2020 > 0) {
											double rate1 = ((gxj2020 - zyavgGrade2020) / 2 + 60) * 0.40;
											rate = rate + rate1;
										} else {
											double rate1 = ((gxj2020 - zyminGrade2020) / 2 + 50) * 0.40;
											rate = rate + rate1;
										}
									} else {
										double rate1 = ((gxj2021 - zyminGrade2021) / 2 + 50) * 0.60;
										rate = rate + rate1;

										double rate2 = ((gxj2020 - zyminGrade2020) / 2 + 50) * 0.40;
										rate = rate + rate2;
									}
								}
							} else {//只有2年数据，全国的
								int heightYears = 0;//这两年中，同位分大于平均分的年份数=2，则+70，如果年份数=1，则+60，都不大于平均分，则+50
								if (zyavgGrade2022 > 0 && qgj2022 - zyavgGrade2022 > 0) heightYears++;
								if (zyavgGrade2021 > 0 && qgj2021 - zyavgGrade2021 > 0) heightYears++;
								if (zyavgGrade2020 > 0 && qgj2020 - zyavgGrade2020 > 0) heightYears++;

								if (zyavgGrade2022 > 0) {//2022年有数据
									if (heightYears == 2) {
										double rate1 = ((qgj2022 - zyavgGrade2022) / 2 + 70) * 0.60;
										rate = rate + rate1;

										if (zyavgGrade2021 > 0) {
											double rate2 = ((qgj2021 - zyavgGrade2021) / 2 + 70) * 0.40;
											rate = rate + rate2;
										} else {
											double rate2 = ((qgj2020 - zyavgGrade2020) / 2 + 70) * 0.40;
											rate = rate + rate2;
										}
									} else if (heightYears == 1) {
										if (qgj2022 - zyavgGrade2022 > 0) {
											double rate1 = ((qgj2022 - zyavgGrade2022) / 2 + 60) * 0.60;
											rate = rate + rate1;
										} else {
											double rate1 = ((qgj2022 - zyminGrade2022) / 2 + 50) * 0.60;
											rate = rate + rate1;
										}
										if (zyavgGrade2021 > 0) {
											if (qgj2021 - zyavgGrade2021 > 0) {
												double rate1 = ((qgj2021 - zyavgGrade2021) / 2 + 60) * 0.40;
												rate = rate + rate1;
											} else {
												double rate1 = ((qgj2021 - zyminGrade2021) / 2 + 60) * 0.40;
												rate = rate + rate1;
											}
										} else {
											if (qgj2020 - zyavgGrade2020 > 0) {
												double rate1 = ((qgj2020 - zyavgGrade2020) / 2 + 60) * 0.40;
												rate = rate + rate1;
											} else {
												double rate1 = ((qgj2020 - zyminGrade2020) / 2 + 60) * 0.40;
												rate = rate + rate1;
											}
										}
									} else {//都不高于平均分
										double rate1 = ((qgj2022 - zyminGrade2022) / 2 + 50) * 0.60;
										rate = rate + rate1;
										if (zyavgGrade2021 > 0) {
											double rate2 = ((qgj2021 - zyminGrade2021) / 2 + 50) * 0.60;
											rate = rate + rate2;
										} else {
											double rate2 = ((qgj2020 - zyminGrade2020) / 2 + 50) * 0.40;
											rate = rate + rate2;
										}
									}
								} else {//2022年没数据，只有2021和2020年数据
									if (heightYears == 2) {
										double rate1 = ((qgj2021 - zyavgGrade2021) / 2 + 70) * 0.60 + ((qgj2020 - zyavgGrade2020) / 2 + 70) * 0.40;
										rate = rate + rate1;
									} else if (heightYears == 1) {
										if (qgj2021 - zyavgGrade2021 > 0) {
											double rate1 = ((qgj2021 - zyavgGrade2021) / 2 + 60) * 0.60;
											rate = rate + rate1;
										} else {
											double rate1 = ((qgj2021 - zyminGrade2021) / 2 + 50) * 0.60;
											rate = rate + rate1;
										}
										if (qgj2020 - zyavgGrade2020 > 0) {
											double rate1 = ((qgj2020 - zyavgGrade2020) / 2 + 60) * 0.40;
											rate = rate + rate1;
										} else {
											double rate1 = ((qgj2020 - zyminGrade2020) / 2 + 50) * 0.40;
											rate = rate + rate1;
										}
									} else {
										double rate1 = ((qgj2021 - zyminGrade2021) / 2 + 50) * 0.60;
										rate = rate + rate1;

										double rate2 = ((qgj2020 - zyminGrade2020) / 2 + 50) * 0.40;
										rate = rate + rate2;
									}
								}

							}


							if (rate >= 100) rate = 99.99;
							if (rate < 1) rate = 1;
							zySubmitRate = rate;
						} else {//只有一年数据
							if (provinceName.equals("广西")) {

								if (zyavgGrade2022 > 0) {
									double rate = ((gxj2022 - zyminGrade2022) / 2) + 50;

									if (rate >= 100) rate = 99.99;
									if (rate < 1) rate = 1;
									zySubmitRate = rate;
								}
								if (zyavgGrade2021 > 0) {
									double rate = ((gxj2021 - zyminGrade2021) / 2) + 50;

									if (rate >= 100) rate = 99.99;
									if (rate < 1) rate = 1;
									zySubmitRate = rate;
								}
								if (zyavgGrade2020 > 0) {
									double rate = ((gxj2020 - zyminGrade2020) / 2) + 50;

									if (rate >= 100) rate = 99.99;
									if (rate < 1) rate = 1;
									zySubmitRate = rate;
								}
							} else {//全国只有一年数据
								if (zyavgGrade2022 > 0) {
									double rate = ((qgj2022 - zyminGrade2022) / 2) + 50;

									if (rate >= 100) rate = 99.99;
									if (rate < 1) rate = 1;
									zySubmitRate = rate;
								}
								if (zyavgGrade2021 > 0) {
									double rate = ((qgj2021 - zyminGrade2021) / 2) + 50;

									if (rate >= 100) rate = 99.99;
									if (rate < 1) rate = 1;
									zySubmitRate = rate;
								}
								if (zyavgGrade2020 > 0) {
									double rate = ((qgj2020 - zyminGrade2020) / 2) + 50;

									if (rate >= 100) rate = 99.99;
									if (rate < 1) rate = 1;
									zySubmitRate = rate;
								}
							}
						}
					}

					 */
				}
			}



			/*
					专业的录取概率:(今年的院校专业组投档概率X80%+现在系统显示的录取概率Ⅹ20%）
					 */
			/*
			for(int s=0;s<plans2024List.size();s++){
				SchoolPlan plan2024= plans2024List.get(s);
				//学校和专业组相等
				if(plan2024.getSchoolCode().equals(scode)
						&&plan2024.getZyz().equals(zyz)){
					//最低录取分数线
					int grade=plan2024.getGrade();
					if(provinceName!=null){
						if(provinceName.equals("广西")) {
							int memberGrade=memberQuery.getGxgrade();
							//((考生成绩-录取最低分)/2+50)*0.8+schoolRecord2022.getSubmitRate()*0.2
							finalZySubmitRate = ((memberGrade - grade) / 2 + 50) * 0.8 + zySubmitRate * 0.2;
							if(finalZySubmitRate>=100) finalZySubmitRate=99.99;
							if(finalZySubmitRate<1) finalZySubmitRate=1;
						}else {
							int memberGrade=memberQuery.getQggrade();
							//((考生成绩-录取最低分)/2+50)*0.8+schoolRecord2022.getSubmitRate()*0.2
							finalZySubmitRate = ((memberGrade - grade) / 2 + 50) * 0.8 + zySubmitRate * 0.2;
							if(finalZySubmitRate>=100) finalZySubmitRate=99.99;
							if(finalZySubmitRate<1) finalZySubmitRate=1;
						}
						zyzPlan.setZySubmitRate(df.format(finalZySubmitRate));//专业投档概率
					}else {
						zyzPlan.setZySubmitRate("-");//专业投档概率
					}
				}
			}

			 */


		}//专业循环



		map.put("zyList",zyzList);


		map.put("totalPlan",totalPlan);

		return AjaxResult.success(map);
	}


	/***
	 *
	 * @param zy  特别注意，这个专业是中文，不是编码
	 * @param zyz
	 * @param scode
	 * @param userId
	 * @return
	 */
	@ApiOperation("根据专业获取专业排名、招生计划数、录取概率")
	@GetMapping("/zypmPlanListBySchoolCodeZyzZy")
	public AjaxResult zypmPlanListBySchoolCodeZyzZy(String zy,String zyz,String scode,String userId){

		if(userId==null||userId.equals("")) {
			//userId="1786281642017542144";
			return AjaxResult.error("请先登录");
		}

		if(isSpecialChar(userId.toString())||sqlValidate(userId.toString())){
			AjaxResult.error("参数包含非法字符");
		}

		BuzMember memberQuery=buzMemberService.selectBuzMemberById(userId);

		if(memberQuery!=null&&memberQuery.getPhone()!=null) {

		}else {

			return AjaxResult.error("会员信息不存在，请先注册成为会员");
		}


		//查找会员的同位分
		BuzMemberGrade memberGradeQuery=new BuzMemberGrade();
		memberGradeQuery.setMemberId(memberQuery.getId());
		List<BuzMemberGrade> memberGradeList=buzMemberGradeService.selectBuzMemberGradeList(memberGradeQuery);



		SchoolPlan schoolPlanQuery=new SchoolPlan();
		schoolPlanQuery.setYear(thisYear);
		schoolPlanQuery.setSchoolCode(scode);
		schoolPlanQuery.setZyz(zyz);
		if("物理".equals(memberQuery.getSxkm())) {
			schoolPlanQuery.setMajorType("理工类");
		}
		if("历史".equals(memberQuery.getSxkm())) {
			schoolPlanQuery.setMajorType("文史类");
		}

		//如果会员不是少数民族，则不能查询民族班
		if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
			schoolPlanQuery.setSsmzFlag(0);
		}

		if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
			schoolPlanQuery.setGjzxFlag(0);
		}

		if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
			schoolPlanQuery.setGxzxFlag(0);
		}

		//考生的再选科目
		schoolPlanQuery.setZxkm(memberQuery.getZxkm());
		schoolPlanQuery.setZy(zy);

		Map map=new HashMap();

		//获取专业排名、专业招生计划数
		List<SchoolPlan> zyzList =schoolPlanService.selectSchoolMajorPmPlanList(schoolPlanQuery);
		map.put("zyzList",zyzList);

		String majorCode="";
		if(zyzList!=null&&zyzList.size()>0){
			SchoolPlan plan=zyzList.get(0);
			majorCode=plan.getMajorCode();
		}

		//获取专业投档概率
		//根据学校编码，查询学校信息
		List<School> schoolList=schoolService.selectByScodeschool(scode);
		School school=null;
		if(schoolList!=null){
			school=schoolList.get(0);
		}
		String provinceName=school.getProvinceName();

		schoolPlanQuery.setSchoolCode(school.getScode());
		List<SchoolPlan> plans2024List =schoolPlanService.selectSchoolZyz2024PlanList(schoolPlanQuery);


		boolean qgjfFlag=true;//是否认可全国加分
		if(school.getRemark()!=null) {
			if(school.getRemark().indexOf("不认可加分")>-1) {//该学校不认可加分，则全国分只取高考分
				qgjfFlag=false;
			}
		}


		DecimalFormat df = new DecimalFormat("#.00");

		String submitRate="";


		//考生近3年的广西排位
		int gxj2022=0;
		int gxj2021=0;
		int gxj2020=0;
		//考生近3年全国排位分
		int qgj2022=0;
		int qgj2021=0;
		int qgj2020=0;

		/**
		 * 计算当年的排名和对应的分数
		 */
		if (provinceName.equals("广西")) {
			if (memberGradeList != null && memberGradeList.size() > 0) {
				for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
					BuzMemberGrade memberGrade = memberGradeList.get(k1);
					if (memberGrade.getYear().intValue() == yearNew1) {
						if (memberGrade.getPmGradeGx() != null) {
							gxj2022=memberGrade.getPmGradeGx();
						}
					}
					if (memberGrade.getYear().intValue() == yearNew2) {
						if (memberGrade.getPmGradeGx() != null) {
							gxj2021=memberGrade.getPmGradeGx();
						}
					}
					if (memberGrade.getYear().intValue() == yearNew3) {
						if (memberGrade.getPmGradeGx() != null) {
							gxj2020=memberGrade.getPmGradeGx();
						}
					}
				}
			}
		} else {
			if (memberGradeList != null && memberGradeList.size() > 0) {
				for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
					BuzMemberGrade memberGrade = memberGradeList.get(k1);
					if (memberGrade.getYear().intValue() == yearNew1) {
						if (memberGrade.getPmGradeGx() != null) {
							qgj2022=memberGrade.getPmGrade();
						}
					}
					if (memberGrade.getYear().intValue() == yearNew2) {
						if (memberGrade.getPmGradeGx() != null) {
							qgj2021=memberGrade.getPmGrade();
						}
					}
					if (memberGrade.getYear().intValue() == yearNew3) {
						if (memberGrade.getPmGradeGx() != null) {
							qgj2020=memberGrade.getPmGrade();
						}
					}
				}
			}
		}


		//需要查找每个专业近3年的数据
		String zyCode="'"+majorCode+"'";//列表中所有的专业编码

		schoolPlanQuery.setYear3(yearNew1+","+yearNew2+","+yearNew3);
		schoolPlanQuery.setMajorName(zyCode);
		List<SchoolPlan> majorList =schoolPlanService.selectSchoolMajorList3Year(schoolPlanQuery);


		int zyavgGrade2022 = 0;
		int zyminGrade2022 = 0;
		int zyavgGrade2021 = 0;
		int zyminGrade2021 = 0;
		int zyavgGrade2020 = 0;
		int zyminGrade2020 = 0;

		double finalZySubmitRate=0;

		for(int k=0;k<majorList.size();k++) {
			SchoolPlan schoolPlan = majorList.get(k);

			//近3年的平均分
			if (schoolPlan.getYear().intValue() == yearNew1) {
				if (schoolPlan.getMajorAvgGrade() != null) {
					zyavgGrade2022 = schoolPlan.getMajorAvgGrade();
				}
				if (schoolPlan.getMajorLowGrade() != null) {
					zyminGrade2022 = schoolPlan.getMajorLowGrade();
				}
			}

			if (schoolPlan.getYear().intValue() == yearNew2) {
				if (schoolPlan.getMajorAvgGrade() != null) {
					zyavgGrade2021 = schoolPlan.getMajorAvgGrade();
				}
				if (schoolPlan.getMajorLowGrade() != null) {
					zyminGrade2021 = schoolPlan.getMajorLowGrade();
				}
			}

			if (schoolPlan.getYear().intValue() == yearNew3) {
				if (schoolPlan.getMajorAvgGrade() != null) {
					zyavgGrade2020 = schoolPlan.getMajorAvgGrade();
				}
				if (schoolPlan.getMajorLowGrade() != null) {
					zyminGrade2020 = schoolPlan.getMajorLowGrade();
				}
			}

			/**
			 * 计算当年的排名和对应的分数
			 */
			if (provinceName.equals("广西")) {
				if (memberGradeList != null && memberGradeList.size() > 0) {
					for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
						BuzMemberGrade memberGrade = memberGradeList.get(k1);
						if (memberGrade.getYear().intValue() == yearNew1) {
							if (memberGrade.getPmGradeGx() != null) {
								gxj2022 = memberGrade.getPmGradeGx();
							}
						}
						if (memberGrade.getYear().intValue() == yearNew2) {
							if (memberGrade.getPmGradeGx() != null) {
								gxj2021 = memberGrade.getPmGradeGx();
							}
						}
						if (memberGrade.getYear().intValue() == yearNew3) {
							if (memberGrade.getPmGradeGx() != null) {
								gxj2020 = memberGrade.getPmGradeGx();
							}
						}
					}
				}
			} else {
				if (memberGradeList != null && memberGradeList.size() > 0) {
					for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
						BuzMemberGrade memberGrade = memberGradeList.get(k1);
						if (memberGrade.getYear().intValue() == yearNew1) {
							if (memberGrade.getPmGradeGx() != null) {
								qgj2022 = memberGrade.getPmGrade();
							}
						}
						if (memberGrade.getYear().intValue() == yearNew2) {
							if (memberGrade.getPmGradeGx() != null) {
								qgj2021 = memberGrade.getPmGrade();
							}
						}
						if (memberGrade.getYear().intValue() == yearNew3) {
							if (memberGrade.getPmGradeGx() != null) {
								qgj2020 = memberGrade.getPmGrade();
							}
						}
					}
				}
			}
		}


		float zySubmitRate=0;
		if(provinceName.equals("广西")) {
			int memberGxGrade=memberQuery.getGxgrade();
			int yearLowGrade=zyminGrade2022;
			if(yearLowGrade==0)	yearLowGrade=zyminGrade2021;
			if(yearLowGrade==0)	yearLowGrade=zyminGrade2020;
			if(memberGxGrade==yearLowGrade){
				zySubmitRate=50;

			}else{
				float cha=(float)(memberGxGrade-yearLowGrade)/2;
				if(cha<0){
					cha=cha-1+50;
				}else{
					cha=cha+1+50;
				}
				if(cha>=100) cha=99.99f;
				if(cha<1) cha=1;
				zySubmitRate=cha;

			}
		}else{
			int memberGxGrade=memberQuery.getQggrade();
			int yearLowGrade=zyminGrade2022;
			if(yearLowGrade==0)	yearLowGrade=zyminGrade2021;
			if(yearLowGrade==0)	yearLowGrade=zyminGrade2020;
			if(memberGxGrade==yearLowGrade){
				zySubmitRate=50;
			}else{
				float cha=(float)(memberGxGrade-yearLowGrade)/2;
				if(cha<0){
					cha=cha-1+50;
				}else{
					cha=cha+1+50;
				}
				if(cha>=100) cha=99.99f;
				if(cha<1) cha=1;
				zySubmitRate=cha;
			}
		}
		submitRate=df.format(zySubmitRate);
		map.put("submitRate",submitRate);

		/*
				if (zyavgGrade2020 > 0 && zyavgGrade2021 > 0 && zyavgGrade2022 > 0) {//3年都有数据
					if (provinceName.equals("广西")) {
						if (gxj2020 - zyavgGrade2020 > 0 && gxj2021 - zyavgGrade2021 > 0 && gxj2022 - zyavgGrade2022 > 0) {//3年的同位分都比录取平均分高
							double rate = ((gxj2022 - zyavgGrade2022) / 2 + 80) * 0.55 + ((gxj2021 - zyavgGrade2021) / 2 + 80) * 0.3 + ((gxj2020 - zyavgGrade2020) / 2 + 80) * 0.15;


							if (rate >= 100) rate = 99.99;
							if (rate < 1) rate = 1;
							submitRate=df.format(rate);
						} else {
							double rate = 0;
							//2年高于
							int count = 0;
							if (gxj2022 - zyavgGrade2022 > 0) {
								count++;
							}
							if (gxj2021 - zyavgGrade2021 > 0) {
								count++;
							}
							if (gxj2020 - zyavgGrade2020 > 0) {
								count++;
							}
							if (count == 2) {//有2年高于同位分的

								if (gxj2022 - zyavgGrade2022 > 0) {
									rate = rate + ((gxj2022 - zyavgGrade2022) / 2 + 70) * 0.55;
								} else {
									rate = rate + ((gxj2022 - zyminGrade2022) / 2 + 50) * 0.55;
								}

								if (gxj2021 - zyavgGrade2021 > 0) {
									rate = rate + ((gxj2021 - zyavgGrade2021) / 2 + 70) * 0.3;
								} else {
									rate = rate + ((gxj2021 - zyminGrade2021) / 2 + 50) * 0.3;
								}

								if (gxj2020 - zyavgGrade2020 > 0) {
									rate = rate + ((gxj2020 - zyavgGrade2020) / 2 + 70) * 0.15;
								} else {
									rate = rate + ((gxj2020 - zyminGrade2020) / 2 + 50) * 0.15;
								}
							} else if (count == 1) {//有1年高于同位分的

								if (gxj2022 - zyavgGrade2022 > 0) {
									rate = rate + ((gxj2022 - zyavgGrade2022) / 2 + 60) * 0.55;
								} else {
									rate = rate + ((gxj2022 - zyminGrade2022) / 2 + 50) * 0.55;
								}

								if (gxj2021 - zyavgGrade2021 > 0) {
									rate = rate + ((gxj2021 - zyavgGrade2021) / 2 + 60) * 0.3;
								} else {
									rate = rate + ((gxj2021 - zyminGrade2021) / 2 + 50) * 0.3;
								}

								if (gxj2020 - zyavgGrade2020 > 0) {
									rate = rate + ((gxj2020 - zyavgGrade2020) / 2 + 60) * 0.15;
								} else {
									rate = rate + ((gxj2020 - zyminGrade2020) / 2 + 50) * 0.15;
								}

							} else {//一个高于的都没有
								rate = ((gxj2022 - zyminGrade2022) / 2 + 50) * 0.55 + ((gxj2021 - zyminGrade2021) / 2 + 50) * 0.3 + ((gxj2020 - zyminGrade2020) / 2 + 50) * 0.15;
							}


							if (rate >= 100) rate = 99.99;
							if (rate < 1) rate = 1;
							submitRate=df.format(rate);
						}
					} else {//全国学校，用全国同位分
						if (qgj2020 - zyavgGrade2020 > 0 && qgj2021 - zyavgGrade2021 > 0 && qgj2022 - zyavgGrade2022 > 0) {//3年的同位分都比录取平均分高
							double rate = ((qgj2022 - zyavgGrade2022) / 2 + 80) * 0.55 + ((qgj2021 - zyavgGrade2021) / 2 + 80) * 0.3 + ((qgj2020 - zyavgGrade2020) / 2 + 80) * 0.15;

							if (rate >= 100) rate = 99.99;
							if (rate < 1) rate = 1;
							submitRate=df.format(rate);
						} else {
							double rate = 0;
							//2年高于
							int count = 0;
							if (qgj2022 - zyavgGrade2022 > 0) {
								count++;
							}
							if (qgj2021 - zyavgGrade2021 > 0) {
								count++;
							}
							if (qgj2020 - zyavgGrade2020 > 0) {
								count++;
							}
							if (count == 2) {//有2年高于同位分的

								if (qgj2022 - zyavgGrade2022 > 0) {
									rate = rate + ((qgj2022 - zyavgGrade2022) / 2 + 70) * 0.55;
								} else {
									rate = rate + ((qgj2022 - zyminGrade2022) / 2 + 50) * 0.55;
								}

								if (qgj2021 - zyavgGrade2021 > 0) {
									rate = rate + ((qgj2021 - zyavgGrade2021) / 2 + 70) * 0.3;
								} else {
									rate = rate + ((qgj2021 - zyminGrade2021) / 2 + 50) * 0.3;
								}

								if (qgj2020 - zyavgGrade2020 > 0) {
									rate = rate + ((qgj2020 - zyavgGrade2020) / 2 + 70) * 0.15;
								} else {
									rate = rate + ((qgj2020 - zyminGrade2020) / 2 + 50) * 0.15;
								}
							} else if (count == 1) {//有1年高于同位分的

								if (qgj2022 - zyavgGrade2022 > 0) {
									rate = rate + ((qgj2022 - zyavgGrade2022) / 2 + 60) * 0.55;
								} else {
									rate = rate + ((qgj2022 - zyminGrade2022) / 2 + 50) * 0.55;
								}

								if (qgj2021 - zyavgGrade2021 > 0) {
									rate = rate + ((qgj2021 - zyavgGrade2021) / 2 + 60) * 0.3;
								} else {
									rate = rate + ((qgj2021 - zyminGrade2021) / 2 + 50) * 0.3;
								}

								if (qgj2020 - zyavgGrade2020 > 0) {
									rate = rate + ((qgj2020 - zyavgGrade2020) / 2 + 60) * 0.15;
								} else {
									rate = rate + ((qgj2020 - zyminGrade2020) / 2 + 50) * 0.15;
								}

							} else {//一个高于的都没有
								rate = ((qgj2022 - zyminGrade2022) / 2 + 50) * 0.55 + ((qgj2021 - zyminGrade2021) / 2 + 50) * 0.3 + ((qgj2020 - zyminGrade2020) / 2 + 50) * 0.15;
							}


							if (rate >= 100) rate = 99.99;
							if (rate < 1) rate = 1;
							submitRate=df.format(rate);
						}
					}
				} else {//数据不满3年
					int years = 0;
					if (zyavgGrade2020 > 0) years++;
					if (zyavgGrade2021 > 0) years++;
					if (zyavgGrade2022 > 0) years++;
					if (years == 2) {
						double rate = 0;
						if (provinceName.equals("广西")) {
							int heightYears = 0;//这两年中，同位分大于平均分的年份数=2，则+70，如果年份数=1，则+60，都不大于平均分，则+50
							if (zyavgGrade2022 > 0 && gxj2022 - zyavgGrade2022 > 0) heightYears++;
							if (zyavgGrade2021 > 0 && gxj2021 - zyavgGrade2021 > 0) heightYears++;
							if (zyavgGrade2020 > 0 && gxj2020 - zyavgGrade2020 > 0) heightYears++;

							if (zyavgGrade2022 > 0) {//2022年有数据
								if (heightYears == 2) {
									double rate1 = ((gxj2022 - zyavgGrade2022) / 2 + 70) * 0.60;
									rate = rate + rate1;

									if (zyavgGrade2021 > 0) {
										double rate2 = ((gxj2021 - zyavgGrade2021) / 2 + 70) * 0.40;
										rate = rate + rate2;
									} else {
										double rate2 = ((gxj2020 - zyavgGrade2020) / 2 + 70) * 0.40;
										rate = rate + rate2;
									}
								} else if (heightYears == 1) {
									if (gxj2022 - zyavgGrade2022 > 0) {
										double rate1 = ((gxj2022 - zyavgGrade2022) / 2 + 60) * 0.60;
										rate = rate + rate1;
									} else {
										double rate1 = ((gxj2022 - zyminGrade2022) / 2 + 50) * 0.60;
										rate = rate + rate1;
									}
									if (zyavgGrade2021 > 0) {
										if (gxj2021 - zyavgGrade2021 > 0) {
											double rate1 = ((gxj2021 - zyavgGrade2021) / 2 + 60) * 0.40;
											rate = rate + rate1;
										} else {
											double rate1 = ((gxj2021 - zyminGrade2021) / 2 + 60) * 0.40;
											rate = rate + rate1;
										}
									} else {
										if (gxj2020 - zyavgGrade2020 > 0) {
											double rate1 = ((gxj2020 - zyavgGrade2020) / 2 + 60) * 0.40;
											rate = rate + rate1;
										} else {
											double rate1 = ((gxj2020 - zyminGrade2020) / 2 + 60) * 0.40;
											rate = rate + rate1;
										}
									}
								} else {//都不高于平均分
									double rate1 = ((gxj2022 - zyminGrade2022) / 2 + 50) * 0.60;
									rate = rate + rate1;
									if (zyavgGrade2021 > 0) {
										double rate2 = ((gxj2021 - zyminGrade2021) / 2 + 50) * 0.60;
										rate = rate + rate2;
									} else {
										double rate2 = ((gxj2020 - zyminGrade2020) / 2 + 50) * 0.40;
										rate = rate + rate2;
									}
								}
							} else {//2022年没数据，只有2021和2020年数据
								if (heightYears == 2) {
									double rate1 = ((gxj2021 - zyavgGrade2021) / 2 + 70) * 0.60 + ((gxj2020 - zyavgGrade2020) / 2 + 70) * 0.40;
									rate = rate + rate1;
								} else if (heightYears == 1) {
									if (gxj2021 - zyavgGrade2021 > 0) {
										double rate1 = ((gxj2021 - zyavgGrade2021) / 2 + 60) * 0.60;
										rate = rate + rate1;
									} else {
										double rate1 = ((gxj2021 - zyminGrade2021) / 2 + 50) * 0.60;
										rate = rate + rate1;
									}
									if (gxj2020 - zyavgGrade2020 > 0) {
										double rate1 = ((gxj2020 - zyavgGrade2020) / 2 + 60) * 0.40;
										rate = rate + rate1;
									} else {
										double rate1 = ((gxj2020 - zyminGrade2020) / 2 + 50) * 0.40;
										rate = rate + rate1;
									}
								} else {
									double rate1 = ((gxj2021 - zyminGrade2021) / 2 + 50) * 0.60;
									rate = rate + rate1;

									double rate2 = ((gxj2020 - zyminGrade2020) / 2 + 50) * 0.40;
									rate = rate + rate2;
								}
							}
						} else {//只有2年数据，全国的
							int heightYears = 0;//这两年中，同位分大于平均分的年份数=2，则+70，如果年份数=1，则+60，都不大于平均分，则+50
							if (zyavgGrade2022 > 0 && qgj2022 - zyavgGrade2022 > 0) heightYears++;
							if (zyavgGrade2021 > 0 && qgj2021 - zyavgGrade2021 > 0) heightYears++;
							if (zyavgGrade2020 > 0 && qgj2020 - zyavgGrade2020 > 0) heightYears++;

							if (zyavgGrade2022 > 0) {//2022年有数据
								if (heightYears == 2) {
									double rate1 = ((qgj2022 - zyavgGrade2022) / 2 + 70) * 0.60;
									rate = rate + rate1;

									if (zyavgGrade2021 > 0) {
										double rate2 = ((qgj2021 - zyavgGrade2021) / 2 + 70) * 0.40;
										rate = rate + rate2;
									} else {
										double rate2 = ((qgj2020 - zyavgGrade2020) / 2 + 70) * 0.40;
										rate = rate + rate2;
									}
								} else if (heightYears == 1) {
									if (qgj2022 - zyavgGrade2022 > 0) {
										double rate1 = ((qgj2022 - zyavgGrade2022) / 2 + 60) * 0.60;
										rate = rate + rate1;
									} else {
										double rate1 = ((qgj2022 - zyminGrade2022) / 2 + 50) * 0.60;
										rate = rate + rate1;
									}
									if (zyavgGrade2021 > 0) {
										if (qgj2021 - zyavgGrade2021 > 0) {
											double rate1 = ((qgj2021 - zyavgGrade2021) / 2 + 60) * 0.40;
											rate = rate + rate1;
										} else {
											double rate1 = ((qgj2021 - zyminGrade2021) / 2 + 60) * 0.40;
											rate = rate + rate1;
										}
									} else {
										if (qgj2020 - zyavgGrade2020 > 0) {
											double rate1 = ((qgj2020 - zyavgGrade2020) / 2 + 60) * 0.40;
											rate = rate + rate1;
										} else {
											double rate1 = ((qgj2020 - zyminGrade2020) / 2 + 60) * 0.40;
											rate = rate + rate1;
										}
									}
								} else {//都不高于平均分
									double rate1 = ((qgj2022 - zyminGrade2022) / 2 + 50) * 0.60;
									rate = rate + rate1;
									if (zyavgGrade2021 > 0) {
										double rate2 = ((qgj2021 - zyminGrade2021) / 2 + 50) * 0.60;
										rate = rate + rate2;
									} else {
										double rate2 = ((qgj2020 - zyminGrade2020) / 2 + 50) * 0.40;
										rate = rate + rate2;
									}
								}
							} else {//2022年没数据，只有2021和2020年数据
								if (heightYears == 2) {
									double rate1 = ((qgj2021 - zyavgGrade2021) / 2 + 70) * 0.60 + ((qgj2020 - zyavgGrade2020) / 2 + 70) * 0.40;
									rate = rate + rate1;
								} else if (heightYears == 1) {
									if (qgj2021 - zyavgGrade2021 > 0) {
										double rate1 = ((qgj2021 - zyavgGrade2021) / 2 + 60) * 0.60;
										rate = rate + rate1;
									} else {
										double rate1 = ((qgj2021 - zyminGrade2021) / 2 + 50) * 0.60;
										rate = rate + rate1;
									}
									if (qgj2020 - zyavgGrade2020 > 0) {
										double rate1 = ((qgj2020 - zyavgGrade2020) / 2 + 60) * 0.40;
										rate = rate + rate1;
									} else {
										double rate1 = ((qgj2020 - zyminGrade2020) / 2 + 50) * 0.40;
										rate = rate + rate1;
									}
								} else {
									double rate1 = ((qgj2021 - zyminGrade2021) / 2 + 50) * 0.60;
									rate = rate + rate1;

									double rate2 = ((qgj2020 - zyminGrade2020) / 2 + 50) * 0.40;
									rate = rate + rate2;
								}
							}

						}


						if (rate >= 100) rate = 99.99;
						if (rate < 1) rate = 1;
						submitRate=df.format(rate);
					} else {//只有一年数据
						if (provinceName.equals("广西")) {

							if (zyavgGrade2022 > 0) {
								double rate = ((gxj2022 - zyminGrade2022) / 2) + 50;

								if (rate >= 100) rate = 99.99;
								if (rate < 1) rate = 1;
								submitRate=df.format(rate);
							}
							if (zyavgGrade2021 > 0) {
								double rate = ((gxj2021 - zyminGrade2021) / 2) + 50;

								if (rate >= 100) rate = 99.99;
								if (rate < 1) rate = 1;
								submitRate=df.format(rate);
							}
							if (zyavgGrade2020 > 0) {
								double rate = ((gxj2020 - zyminGrade2020) / 2) + 50;

								if (rate >= 100) rate = 99.99;
								if (rate < 1) rate = 1;
								submitRate=df.format(rate);
							}
						} else {//全国只有一年数据
							if (zyavgGrade2022 > 0) {
								double rate = ((qgj2022 - zyminGrade2022) / 2) + 50;

								if (rate >= 100) rate = 99.99;
								if (rate < 1) rate = 1;
								submitRate=df.format(rate);
							}
							if (zyavgGrade2021 > 0) {
								double rate = ((qgj2021 - zyminGrade2021) / 2) + 50;

								if (rate >= 100) rate = 99.99;
								if (rate < 1) rate = 1;
								submitRate=df.format(rate);
							}
							if (zyavgGrade2020 > 0) {
								double rate = ((qgj2020 - zyminGrade2020) / 2) + 50;

								if (rate >= 100) rate = 99.99;
								if (rate < 1) rate = 1;
								submitRate=df.format(rate);
							}
						}
					}
				}

		 */
		/*
				if (submitRate!= null&&!submitRate.equals("")) {

					//专业的录取概率:(今年的院校专业组投档概率X80%+现在系统显示的录取概率Ⅹ20%）

					for(int s=0;s<plans2024List.size();s++){
						SchoolPlan plan2024= plans2024List.get(s);
						//学校和专业组相等
						if(plan2024.getSchoolCode().equals(school.getScode())
								&&plan2024.getZyz().equals(zyz)){
							//最低录取分数线
							int grade=plan2024.getGrade();
							if(provinceName!=null){
								if(provinceName.equals("广西")) {
									int memberGrade=memberQuery.getGxgrade();
									//((考生成绩-录取最低分)/2+50)*0.8+schoolRecord2022.getSubmitRate()*0.2
									finalZySubmitRate = ((memberGrade - grade) / 2 + 50) * 0.8 + new Double(submitRate) * 0.2;
									if(finalZySubmitRate>=100) finalZySubmitRate=99.99;
									if(finalZySubmitRate<1) finalZySubmitRate=1;
								}else {
									int memberGrade=memberQuery.getQggrade();
									//((考生成绩-录取最低分)/2+50)*0.8+schoolRecord2022.getSubmitRate()*0.2
									finalZySubmitRate = ((memberGrade - grade) / 2 + 50) * 0.8 + new Double(submitRate) * 0.2;
									if(finalZySubmitRate>=100) finalZySubmitRate=99.99;
									if(finalZySubmitRate<1) finalZySubmitRate=1;
								}
								submitRate=df.format(finalZySubmitRate);//专业投档概率
							}else {
								submitRate="-";//专业投档概率
							}
						}
					}
				}else{
					submitRate="-";
				}

		 */




		return AjaxResult.success(map);
	}



	@ApiOperation("提交志愿填报")
	@RequestMapping(value ="/saveZytb", method = RequestMethod.POST, consumes = "application/json")
	public AjaxResult saveZytb(@RequestBody GkZytb subject){
		if(subject!=null){

			if(StrUtil.isEmpty(subject.getMemberId())) {
				AjaxResult.error("请登陆后再填报");
			}


			if(isSpecialChar(subject.getMemberId().toString())||sqlValidate(subject.getMemberId().toString())){
				AjaxResult.error("参数包含非法字符");
			}

			if(StrUtil.isEmpty(subject.getSchoolCode())) {
				AjaxResult.error("请选择报考院校");
			}


			if(isSpecialChar(subject.getSchoolCode().toString())||sqlValidate(subject.getSchoolCode().toString())){
				AjaxResult.error("参数包含非法字符");
			}

			if(StrUtil.isEmpty(subject.getProvince())) {
				AjaxResult.error("请选择省份");
			}


			if(isSpecialChar(subject.getProvince().toString())||sqlValidate(subject.getProvince().toString())){
				AjaxResult.error("参数包含非法字符");
			}

			if(StrUtil.isEmpty(subject.getZyzCode())) {
				AjaxResult.error("请选择专业组");
			}


			if(isSpecialChar(subject.getZyzCode().toString())||sqlValidate(subject.getZyzCode().toString())){
				AjaxResult.error("参数包含非法字符");
			}

			//根据学校编码，查找学校名称
			List<School> list =schoolService.selectByScodeschool(subject.getSchoolCode());
			if(list==null||list.size()==0){
				AjaxResult.error("请选择正确的学校编码");
			}else{
				School school=list.get(0);
				subject.setSchoolName(school.getSname());
			}

			if(StrUtil.isEmpty(subject.getId())) {
				subject.setId(IdUtil.getSnowflakeNextIdStr());
				subject.setYear(thisYear);
				subject.setCreateTime(new Date());
				subject.setCreateBy(subject.getMemberId());



				gkZytbService.insertGkZytb(subject);

			}else{
				gkZytbService.updateGkZytb(subject);
			}

			gkZytbDetailService.deleteGkZytbDetailByZytbId(subject.getId());

			/**
			 *
			 * 根据学校、专业组，查询专业编码和专业名称
			 */
			SchoolPlan schoolPlan=new SchoolPlan();
			schoolPlan.setYear(thisYear);
			schoolPlan.setZyz(subject.getZyzCode());
			schoolPlan.setSchoolCode(subject.getSchoolCode());
			List<SchoolPlan> marjorList=schoolPlanService.selectSchoolMajorPlanList(schoolPlan);

			String zyAllStr=subject.getZyStr();
			if(zyAllStr!=null){
				String[] zyAllArr=zyAllStr.split(";");
				for(int i=0;i<zyAllArr.length;i++) {
					String zyStr=zyAllArr[i];
					String[] zyArr=zyStr.split(",");
					if(zyArr!=null) {

						int planNums=0;
						String planNumsStr=zyArr[2];
						if(StrUtil.isEmpty(planNumsStr)) {

						}else {
							planNums=new Integer(zyArr[2]);
						}



						GkZytbDetail detail = new GkZytbDetail();
						detail.setGkZytbId(subject.getId());
						detail.setId(IdUtil.getSnowflakeNextIdStr());
						detail.setUserId(subject.getMemberId());
						detail.setMajorPm(zyArr[1]);
						detail.setMajorName(zyArr[0]);

						for(int j=0;j<marjorList.size();j++){
							SchoolPlan myPlan=marjorList.get(j);
							if(myPlan.getMajorName().equals(zyArr[0])){
								detail.setMajorCode(myPlan.getMajorCode());
							}
						}

						if(StrUtil.isEmpty(planNumsStr)) {

						}else {
							detail.setPlanNums(planNums);
						}
						detail.setRateSubmit(zyArr[3]);
						//detail.setRateSubmit();
						gkZytbDetailService.insertGkZytbDetail(detail);

					}
				}
			}
		}
		System.out.println("-------------------"+subject);
		return AjaxResult.success(subject);
	}

	@ApiOperation("删除一键生成的志愿")
	@GetMapping(value = "/delOneKeyAddZytb")
	public AjaxResult delOneKeyAddZytb(String zyId,String pcId){
        if(StrUtil.isEmpty(pcId)) {
            return AjaxResult.error("批次不能为空");
        }

        if(StrUtil.isEmpty(zyId)) {
            return AjaxResult.error("志愿ID不能为空");
        }

        Map map=new HashMap();

        Object pcObj = redisCache.getCacheObject(pcId);
        System.out.println("--------------pcObj--------------------"+pcObj);
        if(pcObj!=null){
            List<GkZytb> allList=(List<GkZytb>)pcObj;
            System.out.println("--------------allList--------------------"+allList.size());
            for(int i=0;i<allList.size();i++){
                GkZytb tb=allList.get(i);
                if(tb.getId().equals(zyId)){
                    allList.remove(tb);
                    break;
                }
            }

            int z=0;
            int c=0;
            int w=0;
            int s=0;
            int b=0;

            List<GkZytb> tbListz=new ArrayList();
            List<GkZytb> tbListc=new ArrayList();
            List<GkZytb> tbListw=new ArrayList();
            List<GkZytb> tbLists=new ArrayList();
            List<GkZytb> tbListb=new ArrayList();

            System.out.println("--------------allList222--------------------"+allList.size());

            for(int i=0;i<allList.size();i++){
                GkZytb tb=allList.get(i);
                String cha=tb.getStype();

                System.out.println("--------------cha--------------------"+cha);

                if(cha.equals("z")){
                    z++;
                    tbListz.add(tb);
                }
                if(cha.equals("c")){
                    c++;
                    tbListc.add(tb);
                }
                if(cha.equals("w")){
                    w++;
                    tbListw.add(tb);
                }
                if(cha.equals("s")){
                    s++;
                    tbLists.add(tb);
                }
                if(cha.equals("b")){
                    b++;
                    tbListb.add(tb);
                }
            }


            map.put("c",c);
            map.put("tbListc",tbListc);
            map.put("z",z);
            map.put("tbListz",tbListz);
            map.put("w",w);
            map.put("tbListw",tbListw);
            map.put("s",s);
            map.put("tbLists",tbLists);
            map.put("b",b);
            map.put("tbListb",tbListb);

            redisCache.deleteObject(pcId);

            redisCache.setCacheObject(pcId,allList,120,TimeUnit.MINUTES);

        }
        return AjaxResult.success(map);
	}

	/****
	 * 冲 25%-35%   8
	 * 争 35%-50%   10
	 * 稳 50%-65%   10
	 * 守 65%-85%    6
	 * 保 85%-99%    6
	 * @param userId
	 * @return
	 */
	@ApiOperation("一键添加志愿填报")
	@GetMapping(value = "/oneKeyAddZytb")
	public AjaxResult oneKeyAddZytb(String userId,String pcId,Integer hasMb){

		/**
		 *院校专业组的投档概率:拿考生输人的成绩a直接和去年的各院校专业组的投档线比较b，a－b=c,如果c＜－30(或等于－30）以下，属于冲的，-31＜c＜0的，属于争，0＜c＜30(或等于30)，属于稳，30＜c＜70(或等于70)，属于守，70＜c以上属于保。各院校专业组投档概率显示为【c➗ 2+50】%
		 * a=考生成绩-各专业组最低录取分数线
		 * -100<a<=-30  冲
		 * -30<a<=0   争
		 * 0<a<=30  稳
		 * 30<a<=70 守
		 * 70<a<=100保
		 * 投档概率=a/2+50
		 * */

		if(StrUtil.isEmpty(userId)) {
			return AjaxResult.error("请先登录");
		}

		if (isSpecialChar(userId.toString()) || sqlValidate(userId.toString())) {
			AjaxResult.error("参数包含非法字符");
		}

		BuzMember memberQuery = buzMemberService.selectBuzMemberById(userId);

		if (memberQuery != null && memberQuery.getPhone() != null) {

		} else {

			return AjaxResult.error("会员信息不存在，请先注册成为会员");
		}

		if (memberQuery.getSfvip().intValue() == 0) {
			return AjaxResult.error("请先升级为VIP会员");
		}


		int z = 0;
		int c = 0;
		int w = 0;
		int s = 0;
		int b = 0;

		List<GkZytb> tbListz = new ArrayList();
		List<GkZytb> tbListc = new ArrayList();
		List<GkZytb> tbListw = new ArrayList();
		List<GkZytb> tbLists = new ArrayList();
		List<GkZytb> tbListb = new ArrayList();

		List<GkZytb> allList = new ArrayList();

		List<BaseArea> children = baseAreaService.selectChildrenList(null);

		//批次为空，说明是第一次生成志愿，否则加载历史志愿
		if(StrUtil.isEmpty(pcId)) {

			pcId = IdUtil.getSnowflakeNextIdStr();


			if (memberQuery.getSxkm() != null && memberQuery.getGrade() != null) {
				SchoolPlan schoolPlanQuery = new SchoolPlan();
				schoolPlanQuery.setYear(thisYear);
				if ("物理".equals(memberQuery.getSxkm())) {
					schoolPlanQuery.setMajorType("理工类");
				}
				if ("历史".equals(memberQuery.getSxkm())) {
					schoolPlanQuery.setMajorType("文史类");
				}
				schoolPlanQuery.setMajorPlan(memberQuery.getGxgrade());

				//获取用户设置的偏好
				GkMemberSetting setting = new GkMemberSetting();
				setting.setMemberId(memberQuery.getId());
				List<GkMemberSetting> list = gkMemberSettingService.selectGkMemberSettingList(setting);
				if (list == null && list.size() == 0) {
					return AjaxResult.error("请设置用户偏好");
				}
				String zy = "";
				String province = "";
				for (int i = 0; i < list.size(); i++) {
					GkMemberSetting memberSetting = list.get(i);
					if ("province".equals(memberSetting.getStype())) {
						province = province + "" + memberSetting.getScode() + ",";
					}
					if ("major".equals(memberSetting.getStype())) {
						zy = zy + "'" + memberSetting.getScode() + "',";
					}
				}
				if (zy.length() > 0) zy = zy.substring(0, zy.length() - 1);
				if (province.length() > 0) province = province.substring(0, province.length() - 1);
				schoolPlanQuery.setProvinceName(province);
				schoolPlanQuery.setZy(zy);
				if(hasMb!=null){
					schoolPlanQuery.setSchoolPlan(hasMb);
				}

				List<SchoolPlan> plans2024List = schoolPlanService.selectSchoolZyz2024PlanList4Tb(schoolPlanQuery);


				List<GkZytb> tbListzTemp = new ArrayList();
				List<GkZytb> tbListcTemp = new ArrayList();
				List<GkZytb> tbListwTemp = new ArrayList();
				List<GkZytb> tbListsTemp = new ArrayList();
				List<GkZytb> tbListbTemp = new ArrayList();

				DecimalFormat df = new DecimalFormat("#.00");

				for (int i = 0; i < plans2024List.size(); i++) {
					SchoolPlan plan = plans2024List.get(i);
					BigDecimal cha = plan.getCha();
					if (cha != null) {
						GkZytb tb = new GkZytb();
						tb.setMemberId(memberQuery.getId());
						tb.setId(IdUtil.getSnowflakeNextIdStr());
						tb.setSchoolCode(plan.getSchoolCode());
						tb.setSchoolName(plan.getSchoolName());
						tb.setZyzCode(plan.getZyz());
						tb.setYear(thisYear);
						tb.setProvince(plan.getSprovinceCode());

						for(int j=0;j<children.size();j++){
							BaseArea area = children.get(j);
							Integer areaId=area.getId();
							if(areaId.toString().equals(plan.getSprovinceCode())){
								tb.setProvinceName(area.getName());
								break;
							}
						}

						if(plan.getZyzPlan()!=null) {
							tb.setPlanNums(plan.getZyzPlan());
						}

						if (plan.getSchoolPm() != null) {
							tb.setQgRank(plan.getSchoolPm().intValue());
						}

						tb.setPcId(pcId);


						float newCha=cha.floatValue();
						if(newCha<50) newCha=newCha-1;
						if(newCha>50) newCha=newCha+1;
						String submit=df.format(newCha);
						tb.setRateSumit(submit);
						tb.setZt(0);
						tb.setSffczytj(1);
						tb.setDataFrom("mn");
						if (newCha >= 25 && newCha < 35) {
							tb.setStype("c");
							tbListcTemp.add(tb);
						}
						if (newCha >= 35 && newCha < 50) {
							tb.setStype("z");
							tbListzTemp.add(tb);
						}
						if (newCha >= 50 && newCha < 65) {
							tb.setStype("w");
							tbListwTemp.add(tb);
						}
						if (newCha >= 65 && newCha < 85) {
							tb.setStype("s");
							tbListsTemp.add(tb);
						}
						if (newCha >= 85) {
							tb.setStype("b");
							tbListbTemp.add(tb);
						}
					}

				}
				if (tbListzTemp.size() >= 8) {
					z = 8;
					Collections.shuffle(tbListzTemp);
					for (int j = 0; j < 8; j++) {
						GkZytb zytb = tbListzTemp.get(j);
						tbListz.add(zytb);
					}
				} else {
					z = tbListzTemp.size();
					for (int j = 0; j < tbListzTemp.size(); j++) {
						GkZytb zytb = tbListzTemp.get(j);
						tbListz.add(zytb);
					}
				}

				if (tbListcTemp.size() >= 10) {
					c = 10;
					Collections.shuffle(tbListcTemp);
					for (int j = 0; j < 10; j++) {

						GkZytb zytb = tbListcTemp.get(j);

						tbListc.add(zytb);
					}
				} else {
					c = tbListcTemp.size();

					for (int j = 0; j < tbListcTemp.size(); j++) {
						GkZytb zytb = tbListcTemp.get(j);
						tbListc.add(zytb);
					}
				}

				if (tbListwTemp.size() >= 10) {
					w = 10;
					Collections.shuffle(tbListwTemp);
					for (int j = 0; j < 10; j++) {
						GkZytb zytb = tbListwTemp.get(j);
						tbListw.add(tbListwTemp.get(j));
					}
				} else {
					w = tbListwTemp.size();

					for (int j = 0; j < tbListwTemp.size(); j++) {
						GkZytb zytb = tbListwTemp.get(j);
						tbListw.add(zytb);
					}

				}

				if (tbListsTemp.size() >= 6) {
					s = 6;
					Collections.shuffle(tbListsTemp);
					for (int j = 0; j < 6; j++) {

						GkZytb zytb = tbListsTemp.get(j);

						tbLists.add(tbListsTemp.get(j));
					}
				} else {
					s = tbListsTemp.size();

					for (int j = 0; j < tbListsTemp.size(); j++) {
						GkZytb zytb = tbListsTemp.get(j);
						tbLists.add(zytb);
					}

				}

				if (tbListbTemp.size() >= 6) {
					b = 6;
					Collections.shuffle(tbListbTemp);
					for (int j = 0; j < 6; j++) {

						GkZytb zytb = tbListbTemp.get(j);
						String rateSumit = zytb.getRateSumit();
						if (rateSumit != null) {
							Double rate = new Double(rateSumit);
							if (rate >= 100) rate = 99.99;
							zytb.setRateSumit(rate.toString());
						}


						tbListb.add(tbListbTemp.get(j));
					}
				} else {
					b = tbListbTemp.size();

					for (int j = 0; j < tbListbTemp.size(); j++) {
						GkZytb zytb = tbListbTemp.get(j);
						tbListb.add(zytb);
					}

				}
			}


			gkZytbService.insertGkZytbDetailByPcId(pcId);


		}else{
			Object pcObj = redisCache.getCacheObject(pcId);
			if(pcObj!=null){
				List<GkZytb> allList2=(List<GkZytb>)pcObj;


				for(int i=0;i<allList2.size();i++){
					GkZytb tb=allList2.get(i);
					String cha=tb.getStype();

					if(cha.equals("z")){
						z++;
						tbListz.add(tb);
					}
					if(cha.equals("c")){
						c++;
						tbListc.add(tb);
					}
					if(cha.equals("w")){
						w++;
						tbListw.add(tb);
					}
					if(cha.equals("s")){
						s++;
						tbLists.add(tb);
					}
					if(cha.equals("b")){
						b++;
						tbListb.add(tb);
					}
				}
			}
		}

		Map map=new HashMap();
		map.put("c",c);
		map.put("tbListc",tbListc);
		map.put("z",z);
		map.put("tbListz",tbListz);
		map.put("w",w);
		map.put("tbListw",tbListw);
		map.put("s",s);
		map.put("tbLists",tbLists);
		map.put("b",b);
		map.put("tbListb",tbListb);

        allList.addAll(tbListc);
        allList.addAll(tbListz);
        allList.addAll(tbListw);
        allList.addAll(tbLists);
        allList.addAll(tbListb);



        redisCache.setCacheObject(pcId,allList,120,TimeUnit.MINUTES);

		System.out.println("--------------一键生成志愿，生成批次-------------"+pcId);

		return AjaxResult.success(map);
	}


    @ApiOperation("保存一键生成的志愿")
    @GetMapping(value = "/saveOneKeyAddZytb")
    public AjaxResult saveOneKeyAddZytb(String pcId){
        if(StrUtil.isEmpty(pcId)) {
            return AjaxResult.error("批次不能为空");
        }

		System.out.println("---------有没有传递批次-----pcId--------------------"+pcId);


        Map map=new HashMap();

        Object pcObj = redisCache.getCacheObject(pcId);
        if(pcObj!=null){

			String userId="";
			String province="";
			String schoolCode="";
			String zyz="";

            List<GkZytb> allList=(List<GkZytb>)pcObj;
            System.out.println("--------------allList--------------------"+allList.size());
            for(int i=0;i<allList.size();i++){
                GkZytb tb=allList.get(i);
                tb.setZt(1);

				userId=tb.getMemberId();
				province=tb.getProvince();
				schoolCode=tb.getSchoolCode();
				zyz= tb.getZyzCode();

				//批量生成该志愿的明细表
            }
			//查找当前用户的最大志愿号
			GkZytb query=new GkZytb();
			query.setMemberId(userId);
			List<GkZytb> maxList=gkZytbService.selectGkZytbMaxZyseqList(query);
			int maxSeq=0;
			if(maxList!=null&&maxList.size()>0){
				GkZytb max=maxList.get(0);
				if(max!=null&&max.getZyseq()!=null){
					maxSeq=max.getZyseq();
				}
			}
			for(int i=0;i<allList.size();i++) {
				GkZytb tb = allList.get(i);
				maxSeq++;
				tb.setZyseq(maxSeq);
			}

/*
			BuzMember memberQuery=buzMemberService.selectBuzMemberById(userId);

			if(memberQuery!=null&&memberQuery.getPhone()!=null) {

			}else {

				return AjaxResult.error("会员信息不存在，请先注册成为会员");
			}

			if(memberQuery.getSfvip().intValue()==0) {
				return AjaxResult.error("系统已更新，非会员不能查询");
			}

			if(schoolCode==null||schoolCode.trim().equals("")) {
				return AjaxResult.error("请选择学校");
			}

			if(zyz==null||zyz.trim().equals("")) {
				return AjaxResult.error("请选择专业组");
			}

			if(isSpecialChar(schoolCode.toString())||sqlValidate(schoolCode.toString())){
				AjaxResult.error("参数包含非法字符");
			}

			if(isSpecialChar(zyz.toString())||sqlValidate(zyz.toString())){
				AjaxResult.error("参数包含非法字符");
			}


			//查找会员的同位分
			BuzMemberGrade memberGradeQuery=new BuzMemberGrade();
			memberGradeQuery.setMemberId(memberQuery.getId());
			List<BuzMemberGrade> memberGradeList=buzMemberGradeService.selectBuzMemberGradeList(memberGradeQuery);


			School schoolQuery=new School();


			if("物理".equals(memberQuery.getSxkm())) {
				schoolQuery.setMajorType("理工类");
			}
			if("历史".equals(memberQuery.getSxkm())) {
				schoolQuery.setMajorType("文史类");
			}

			//如果会员不是少数民族，则不能查询民族班
			if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
				schoolQuery.setSsmzFlag(0);
			}

			if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
				schoolQuery.setGjzxFlag(0);
			}

			if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
				schoolQuery.setGxzxFlag(0);
			}

			//考生的再选科目
			schoolQuery.setZxkm(memberQuery.getZxkm());

			schoolQuery.setScode(schoolCode);



 */









			//批量插入志愿
			gkZytbService.insertGkZytbList(allList);


            //redisCache.deleteObject(pcId);

			gkZytbService.insertGkZytbDetailByPcId(pcId);

        }
        return AjaxResult.success(map);
    }


    @ApiOperation("专业选科目/院校选专业")
    @RequestMapping("/major/select/subject")
    public TableDataInfo majorSubjectlist(@RequestBody SMajorsSubjectVo subject){
        startPage();
        List<SMajorsSubjectVo> list = smSubjectService.selectmajorSubjectList(subject);
        return getDataTable(list);
    }

    /**
     * 根据字典类型查询字典数据信息
     */
    @GetMapping(value = "dict/type/{dictType}")
    public AjaxResult dictType(@PathVariable String dictType)
    {

    	if(isSpecialChar(dictType.toString())||sqlValidate(dictType.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
        List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
        if (StringUtils.isNull(data))
        {
            data = new ArrayList<SysDictData>();
        }
        return AjaxResult.success(data);
    }


	/**
	 * 根据手机号检测会员是否存在
	 * @return
	 */
	@GetMapping("/memberCheck")
	public AjaxResult memberCheck(String telephone)
	{
		if(StrUtil.isEmpty(telephone)) {
			AjaxResult.error("手机号码不能为空");
		}


		if(isSpecialChar(telephone.toString())||sqlValidate(telephone.toString())){
			AjaxResult.error("参数包含非法字符");
		}



		BuzMember memberQuery=new BuzMember();
		memberQuery.setPhone(telephone);
		List<BuzMember> list=buzMemberService.selectBuzMemberList(memberQuery);

		Map map=new HashMap();
		if(list!=null&&list.size()>0) {
			BuzMember member=list.get(0);
			map.put("hasMember",member.getId());
		}else {
			/*****
			 * 如果会员不存在，注册一个会员，默认密码为
			 */
			memberQuery.setPwd("985211");
			memberQuery.setGrade(588);
			memberQuery.setSxkm("物理");
			memberQuery.setZxkm("化学,生物");
			memberQuery.setSfssmz(0);
			memberQuery.setSfgjzxdfzx(0);
			memberQuery.setSfvip(0);
			memberQuery.setYear(2024);
			memberQuery.setQggrade(588);
			memberQuery.setGxgrade(588);
			memberQuery.setSfdfzx(0);
			memberQuery.setUserType(1);
			memberQuery.setId(IdUtil.getSnowflakeNextIdStr());

			buzMemberService.insertBuzMember(memberQuery);

			map.put("hasMember",memberQuery.getId());
		}

		return AjaxResult.success(map);
	}

	/**
	 * 会员信息同步
	 * @return
	 */
	@GetMapping("/memberSyn")
	public AjaxResult memberSyn(String telephone,String appid,String secret)
	{
		if(StrUtil.isEmpty(telephone)) {
			AjaxResult.error("手机号码不能为空");
		}

		if(StrUtil.isEmpty(appid)) {
			AjaxResult.error("商户id不能为空");
		}

		if(StrUtil.isEmpty(secret)) {
			AjaxResult.error("商户秘钥不能为空");
		}
		if(isSpecialChar(telephone.toString())||sqlValidate(telephone.toString())){
			AjaxResult.error("参数包含非法字符");
		}

		if(!appid.equals("yzl")){
			AjaxResult.error("商户id不存在");
		}
		if(!secret.equals("yzl38595d1a7d")){
			AjaxResult.error("商户秘钥不正确");
		}

		/**
		 * 调用用户接口，进行二次确认
		 * 接口地址：【xxxxx商户网址/api/memberSynConfirm】
		 * 请求方式：get
		 * 参数： telephone  用户手机号码
		 * 返回值 "data": 1       1:表示已充值。0：表示未充值
		 */
		HttpRequest getRequest = HttpUtil.createGet("https://fc-mp-c3a2da4b-b0e0-4e19-9266-821508fec011.next.bspapp.com/http/router/memberSynConfirm?telephone="+telephone);
		getRequest.header("Accept", "application/json");
		//getRequest.
		HttpResponse getResponse = getRequest.execute();
		System.out.println("GET Response Body: " + getResponse.body());
		String retStr=getResponse.body();
		JSONObject jsonObject = JSONUtil.parseObj(retStr);
		Integer retData=(Integer)jsonObject.get("data");
		if(retData!=null&&retData.intValue()==1) {
			/**
			 * 验证通过后，修改用户的会员状态
			 */
			BuzMember memberQuery = new BuzMember();
			memberQuery.setPhone(telephone);
			List<BuzMember> list2 = buzMemberService.selectBuzMemberList(memberQuery);
			if (list2 != null && list2.size() > 0) {
				BuzMember buzMember = list2.get(0);
				buzMember.setSfvip(1);
				buzMemberService.updateBuzMember(buzMember);
			}else{
				memberQuery.setPwd("985211");
				memberQuery.setGrade(588);
				memberQuery.setSxkm("物理");
				memberQuery.setZxkm("化学,生物");
				memberQuery.setSfssmz(0);
				memberQuery.setSfgjzxdfzx(0);
				memberQuery.setSfvip(1);
				memberQuery.setYear(2025);
				memberQuery.setQggrade(580);
				memberQuery.setGxgrade(580);
				memberQuery.setSfdfzx(0);
				memberQuery.setUserType(1);
				memberQuery.setGradePm(12909);
				memberQuery.setGradePmGx(12970);
				memberQuery.setId(IdUtil.getSnowflakeNextIdStr());

				buzMemberService.insertBuzMember(memberQuery);

				//生成考生近3年的同位分(全国)
				List<BuzMemberGrade> list=new ArrayList();

				GkGradeDoc gkGradeDocQuery=new GkGradeDoc();
				if("物理".equals(memberQuery.getSxkm())) {
					gkGradeDocQuery.setGradeClass("工类");
				}
				if("历史".equals(memberQuery.getSxkm())) {
					gkGradeDocQuery.setGradeClass("史类");
				}
				gkGradeDocQuery.setUseIn("全国");
				gkGradeDocQuery.setSeq(memberQuery.getGradePm());
				List<GkGradeDoc> gradeDocList=gkGradeDocService.selectGkGradeDocListBySeq(gkGradeDocQuery);
				if(gradeDocList.size()<=6) {
					for (int i = 0; i < gradeDocList.size(); i++) {
						GkGradeDoc doc = gradeDocList.get(i);
						BuzMemberGrade grade2023 = new BuzMemberGrade();
						grade2023.setMemberId(memberQuery.getId());
						grade2023.setYear(doc.getYear());
						grade2023.setPmGrade(doc.getGrade());
						list.add(grade2023);
					}
				}

				gkGradeDocQuery=new GkGradeDoc();
				if("物理".equals(memberQuery.getSxkm())) {
					gkGradeDocQuery.setGradeClass("工类");
				}
				if("历史".equals(memberQuery.getSxkm())) {
					gkGradeDocQuery.setGradeClass("史类");
				}
				gkGradeDocQuery.setUseIn("广西");
				gkGradeDocQuery.setSeq(memberQuery.getGradePmGx());
				List<GkGradeDoc> gradeDocListGx=gkGradeDocService.selectGkGradeDocListBySeq(gkGradeDocQuery);
				if(gradeDocListGx.size()<=6) {
					for (int j = 0; j < list.size(); j++) {
						BuzMemberGrade grade2023 = list.get(j);
						Integer year = grade2023.getYear();
						for (int i = 0; i < gradeDocListGx.size(); i++) {
							GkGradeDoc doc = gradeDocListGx.get(i);
							Integer year2 = doc.getYear();
							if (year.intValue() == year2.intValue()) {
								grade2023.setPmGradeGx(doc.getGrade());
								break;
							}
						}
					}
				}
				if(list.size()>0) {
					buzMemberGradeService.insertBuzMemberGradeList(list);
				}
			}

			return AjaxResult.success();
		}else{
			return AjaxResult.error("会员未充值");
		}
	}

    /**
     * 查询地区列表
     */
    @GetMapping("/children/list")
    public List<BaseArea> getChildren(BaseArea baseArea)
    {
    	if(baseArea!=null&&baseArea.getId()!=null) {
	    	if(isSpecialChar(baseArea.getId().toString())||sqlValidate(baseArea.getId().toString())){
	    		AjaxResult.error("参数包含非法字符");
	    	}
    	}
    	
//        startPage();
        List<BaseArea> children = baseAreaService.selectChildrenList(baseArea);

        return children;
    }

    @ApiOperation("院校对应专业详情信息")
    @GetMapping("/school/smajors/detail")
    public TableDataInfo schoolSmajorslist( SchoolsmajorsDetail schoolsmajorsDetail){
        startPage();
        List<SchoolsmajorsDetail> list = schoolService.selectschoolSmajorsList(schoolsmajorsDetail);
        return getDataTable(list);
    }

    @ApiOperation("院校选专业")
    @RequestMapping("/school/smajors/list")
    public TableDataInfo schoolsmajors( School school)
    {
        startPage();
        List<School> list = schoolService.schoolsmajors(school);
        return getDataTable(list);
    }

    @ApiOperation("根据学校代码找学校")
    @RequestMapping("/schoolscode/list/{scode}")
    public TableDataInfo selectByScodeschool(@PathVariable String scode)
    {
        startPage();
        List<School> list = schoolService.selectByScodeschool(scode);
        return getDataTable(list);
    }
    
    @ApiOperation("综合分析学校总数")
    @GetMapping("/zhfxListTotal")
    public AjaxResult zhfxListTotal(String pageType,String province,String schoolTypes,String schoolLevel,String schoolCode2,String batch,String userId,String schoolCodeInp,String schoolNameInp)
    {
    	if(userId==null||userId.equals("")) {
    		//userId="1786281642017542144";
    		return AjaxResult.error("请先登录");
    	}
    	
    	if(isSpecialChar(userId.toString())||sqlValidate(userId.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	BuzMember memberQuery=buzMemberService.selectBuzMemberById(userId);

    	if(memberQuery!=null&&memberQuery.getPhone()!=null) {
    		
    	}else {
    		
    		return AjaxResult.error("会员信息不存在，请先注册成为会员");
    	}
    	
        
        
        /****
         * 1、查找满足条件的学校
         * 2、获取每个学校的专业组
         * 3、需要根据考生是文科还是理科，根据公式，计算投档率
         */
        
        SchoolPlan schoolQuery=new SchoolPlan();
        if(province!=null&&!province.equals("")) {
        	
        	if(isSpecialChar(province.toString())||sqlValidate(province.toString())){
        		AjaxResult.error("参数包含非法字符");
        	}

            if(province.charAt(province.length()-1)==',') {
                province = province.substring(0, province.length() - 1);
            }
            schoolQuery.setSprovince(province);
        }
        
        if(schoolTypes!=null&&!schoolTypes.equals("")) {
        	
        	if(isSpecialChar(schoolTypes.toString())||sqlValidate(schoolTypes.toString())){
        		AjaxResult.error("参数包含非法字符");
        	}
            if(schoolTypes.charAt(schoolTypes.length()-1)==',') {
                schoolTypes = schoolTypes.substring(0, schoolTypes.length() - 1);
            }
        	schoolQuery.setStypes(schoolTypes);
        }

        if(schoolLevel!=null&&!schoolLevel.equals("")) {
        	
        	if(isSpecialChar(schoolLevel.toString())||sqlValidate(schoolLevel.toString())){
        		AjaxResult.error("参数包含非法字符");
        	}
            if(schoolLevel.charAt(schoolLevel.length()-1)==',') {
                schoolLevel = schoolLevel.substring(0, schoolLevel.length() - 1);
            }
            String[] schoolLevelArr=schoolLevel.split(",");
            String sqlStr="";
            for(int i=0;i<schoolLevelArr.length;i++){
                String str=schoolLevelArr[i];
                sqlStr=sqlStr+" c.college_level like '%"+str+"%' ";
                if(i<schoolLevelArr.length-1){
                    sqlStr=sqlStr+" or ";
                }
            }


            schoolQuery.setCollegeLevel(sqlStr);
        }

        
        
        if(schoolCode2!=null&&!schoolCode2.equals("")) {
        	
        	if(isSpecialChar(schoolCode2.toString())||sqlValidate(schoolCode2.toString())){
        		AjaxResult.error("参数包含非法字符");
        	}
        	
        	schoolQuery.setSchoolCode(schoolCode2);
        }
        
        
        if(schoolCodeInp!=null&&!schoolCodeInp.equals("")) {
        	
        	if(isSpecialChar(schoolCodeInp.toString())||sqlValidate(schoolCodeInp.toString())){
        		AjaxResult.error("参数包含非法字符");
        	}
        	
        	schoolQuery.setSchoolCode(schoolCodeInp);
        }

	if(schoolNameInp!=null&&!schoolNameInp.equals("")) {
		
		if(isSpecialChar(schoolNameInp.toString())||sqlValidate(schoolNameInp.toString())){
			AjaxResult.error("参数包含非法字符");
		}
		
		schoolQuery.setSchoolName(schoolNameInp);
	}


		if(pageType!=null&&!pageType.equals("")) {

			if(isSpecialChar(pageType.toString())||sqlValidate(pageType.toString())){
				AjaxResult.error("参数包含非法字符");
			}
			if(pageType.equals("c")) {
				schoolQuery.setSubmitPageType(1);
			}
			if(pageType.equals("z")) {
				schoolQuery.setSubmitPageType(2);
			}
			if(pageType.equals("w")) {
				schoolQuery.setSubmitPageType(3);
			}
			if(pageType.equals("s")) {
				schoolQuery.setSubmitPageType(4);
			}
			if(pageType.equals("b")) {
				schoolQuery.setSubmitPageType(5);
			}


		}

        schoolQuery.setGrade(memberQuery.getGrade());
        
        
        if("物理".equals(memberQuery.getSxkm())) {
        	schoolQuery.setMajorType("理工类");
    	}
    	if("历史".equals(memberQuery.getSxkm())) {
    		schoolQuery.setMajorType("文史类");
    	}
    	
    	//如果会员不是少数民族，则不能查询民族班
    	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
    		schoolQuery.setSsmzFlag(0);
    	}
    	
    	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
    		schoolQuery.setGjzxFlag(0);
    	}
    	
    	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
    		schoolQuery.setGxzxFlag(0);
    	}
    	
    	//考生的再选科目
    	schoolQuery.setZxkm(memberQuery.getZxkm());

        List<SchoolPlan> zyzList =schoolPlanService.selectZyzfxList(schoolQuery);

        //List list=schoolService.selectSchoolListBy2024(schoolQuery);
        return  AjaxResult.success(zyzList.size());
    }



	@ApiOperation("选科总数")
	@GetMapping("/xueke_listTotal")
	public AjaxResult xueke_listTotal(String sxkm,String zxkm,String province,String schoolCodeInp,String schoolNameInp,String userId)
	{
		if(userId==null||userId.equals("")) {
			//userId="1786281642017542144";
			return AjaxResult.error("请先登录");
		}

		if(isSpecialChar(userId.toString())||sqlValidate(userId.toString())){
			AjaxResult.error("参数包含非法字符");
		}

		BuzMember memberQuery=buzMemberService.selectBuzMemberById(userId);

		if(memberQuery!=null&&memberQuery.getPhone()!=null) {

		}else {

			return AjaxResult.error("会员信息不存在，请先注册成为会员");
		}



		/****
		 * 1、查找满足条件的学校
		 * 2、获取每个学校的专业组
		 * 3、需要根据考生是文科还是理科，根据公式，计算投档率
		 */

		School schoolQuery=new School();

		if (isSpecialChar(sxkm.toString()) || sqlValidate(sxkm.toString())) {
			AjaxResult.error("参数包含非法字符");
		}

		if (isSpecialChar(zxkm.toString()) || sqlValidate(zxkm.toString())) {
			AjaxResult.error("参数包含非法字符");
		}

		if ("物理".equals(sxkm)) {
			schoolQuery.setMajorType("理工类");
		}
		if ("历史".equals(sxkm)) {
			schoolQuery.setMajorType("文史类");
		}



		if(zxkm!=null) {
			//考生的再选科目
			schoolQuery.setZxkm(zxkm);
		}
		if(province!=null&&!province.equals("")) {

			if(isSpecialChar(province.toString())||sqlValidate(province.toString())){
				AjaxResult.error("参数包含非法字符");
			}

			schoolQuery.setSprovince(new Long(province));
		}
/*
		if(schoolTypes!=null&&!schoolTypes.equals("")) {

			if(isSpecialChar(schoolTypes.toString())||sqlValidate(schoolTypes.toString())){
				AjaxResult.error("参数包含非法字符");
			}

			schoolQuery.setStypes(schoolTypes);
		}

		if(schoolLevel!=null&&!schoolLevel.equals("")) {

			if(isSpecialChar(schoolLevel.toString())||sqlValidate(schoolLevel.toString())){
				AjaxResult.error("参数包含非法字符");
			}

			schoolQuery.setCollegeLevel(schoolLevel);
		}


		if(schoolCode2!=null&&!schoolCode2.equals("")) {

			if(isSpecialChar(schoolCode2.toString())||sqlValidate(schoolCode2.toString())){
				AjaxResult.error("参数包含非法字符");
			}

			schoolQuery.setScode(schoolCode2);
		}
*/

		if(schoolCodeInp!=null&&!schoolCodeInp.equals("")) {

			if(isSpecialChar(schoolCodeInp.toString())||sqlValidate(schoolCodeInp.toString())){
				AjaxResult.error("参数包含非法字符");
			}

			schoolQuery.setScode(schoolCodeInp);
		}

		if(schoolNameInp!=null&&!schoolNameInp.equals("")) {

			if(isSpecialChar(schoolNameInp.toString())||sqlValidate(schoolNameInp.toString())){
				AjaxResult.error("参数包含非法字符");
			}

			schoolQuery.setSname(schoolNameInp);
		}
		List list = schoolService.selectSchoolListBy2024(schoolQuery);
		return AjaxResult.success(list.size());
		/*
		if(bkyx!=null&&bkyx.equals("1")) {
			List list = schoolService.selectSchoolListBy2024(schoolQuery);
			return AjaxResult.success(list.size());
		}else{
			List list = schoolService.selectSchoolListBy2024NotIn(schoolQuery);
			return AjaxResult.success(list.size());
		}
		*/
	}
    
    
    @ApiOperation("专业分析总数")
    @GetMapping("/zyfxListTotal")
    public AjaxResult zyfxListTotal(String zyName,String province,String batch,String userId)
    {
    	if(userId==null||userId.equals("")) {
    		return AjaxResult.error("请先登录");
    	}
    	
    	if(isSpecialChar(userId.toString())||sqlValidate(userId.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	BuzMember memberQuery=buzMemberService.selectBuzMemberById(userId);

    	if(memberQuery!=null&&memberQuery.getPhone()!=null) {
    		
    	}else {
    		
    		return AjaxResult.error("会员信息不存在，请先注册成为会员");
    	}
    	
    	if(zyName!=null&&!zyName.trim().equals("")) {
    		
    		if(isSpecialChar(zyName.toString())||sqlValidate(zyName.toString())){
        		AjaxResult.error("参数包含非法字符");
        	}
    	}else {
    		AjaxResult.error("请输入专业名称");
    	}
    	
    	
    	
    	/*
    	School schoolQuery=new School();
        
        
        if("物理".equals(memberQuery.getSxkm())) {
        	schoolQuery.setMajorType("理工类");
    	}
    	if("历史".equals(memberQuery.getSxkm())) {
    		schoolQuery.setMajorType("文史类");
    	}
    	
    	
    	//如果会员不是少数民族，则不能查询民族班
    	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
    		schoolQuery.setSsmzFlag(0);
    	}
    	
    	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
    		schoolQuery.setGjzxFlag(0);
    	}
    	
    	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
    		schoolQuery.setGxzxFlag(0);
    	}
    	
    	//考生的再选科目
    	schoolQuery.setZxkm(memberQuery.getZxkm());   
    	schoolQuery.setZy(zyName);

        
        String schoolCode="";//列表中所有的学校
        
        
        List<School> list = schoolService.selectSchoolListBy2024(schoolQuery);
        
        if(list!=null&&list.size()>0) {
        	for(int i=0;i<list.size();i++) {
        		School school=list.get(i);
        		schoolCode=schoolCode+"'"+school.getScode()+"',";
        	}
        }
        */


        	//查询专业组
        	SchoolPlan schoolPlanQuery=new SchoolPlan();
        	schoolPlanQuery.setYear(thisYear);

        	if("物理".equals(memberQuery.getSxkm())) {
        		schoolPlanQuery.setMajorType("理工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		schoolPlanQuery.setMajorType("文史类");
        	}
        	
        	//如果会员不是少数民族，则不能查询民族班
        	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
        		schoolPlanQuery.setSsmzFlag(0);
        	}
        	
        	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
        		schoolPlanQuery.setGjzxFlag(0);
        	}
        	
        	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
        		schoolPlanQuery.setGxzxFlag(0);
        	}
        	
        	//考生的再选科目
        	schoolPlanQuery.setZxkm(memberQuery.getZxkm());
        	
        	schoolPlanQuery.setZy(zyName);

        if(province!=null&&!province.equals("")) {

            if(isSpecialChar(province.toString())||sqlValidate(province.toString())){
                AjaxResult.error("参数包含非法字符");
            }
            if(province.charAt(province.length()-1)==',') {
                province = province.substring(0, province.length() - 1);
            }
            schoolPlanQuery.setSprovince(province);
        }
        	
        	List<SchoolPlan> zyzList =schoolPlanService.selectZyfxList(schoolPlanQuery);

			
			return  AjaxResult.success(zyzList.size());

    }




	@ApiOperation("选科列表")
	@GetMapping("/xueke_list")
	public AjaxResult xueke_list(String sxkm,String zxkm,String province,String schoolCodeInp,String schoolNameInp,String userId,Integer pageNum) {
		//System.out.println("--------province------"+province);

		if (userId == null || userId.equals("")) {
			//userId="1786281642017542144";
			return AjaxResult.error("请先登录");
		}

		if (isSpecialChar(userId.toString()) || sqlValidate(userId.toString())) {
			AjaxResult.error("参数包含非法字符");
		}

		BuzMember memberQuery = buzMemberService.selectBuzMemberById(userId);

		if (memberQuery != null && memberQuery.getPhone() != null) {

		} else {

			return AjaxResult.error("会员信息不存在，请先注册成为会员");
		}

		if (memberQuery.getSfvip().intValue() == 0) {
			return AjaxResult.error("系统已更新，非会员不能查询");
		}

		/****
		 * 1、查找满足条件的学校
		 * 2、获取每个学校的专业组
		 * 3、需要根据考生是文科还是理科，根据公式，计算投档率
		 */

		School schoolQuery=new School();


		if (isSpecialChar(sxkm.toString()) || sqlValidate(sxkm.toString())) {
			AjaxResult.error("参数包含非法字符");
		}

		if (isSpecialChar(zxkm.toString()) || sqlValidate(zxkm.toString())) {
			AjaxResult.error("参数包含非法字符");
		}


		if ("物理".equals(sxkm)) {
			schoolQuery.setMajorType("理工类");
		}
		if ("历史".equals(sxkm)) {
			schoolQuery.setMajorType("文史类");
		}



		if(zxkm!=null) {
			//考生的再选科目
			schoolQuery.setZxkm(zxkm);
		}


		if(province!=null&&!province.equals("")) {

			if(isSpecialChar(province.toString())||sqlValidate(province.toString())){
				AjaxResult.error("参数包含非法字符");
			}

			schoolQuery.setSprovince(new Long(province));
		}
/*
		if(schoolTypes!=null&&!schoolTypes.equals("")) {

			if(isSpecialChar(schoolTypes.toString())||sqlValidate(schoolTypes.toString())){
				AjaxResult.error("参数包含非法字符");
			}

			schoolQuery.setStypes(schoolTypes);
		}

		if(schoolLevel!=null&&!schoolLevel.equals("")) {

			if(isSpecialChar(schoolLevel.toString())||sqlValidate(schoolLevel.toString())){
				AjaxResult.error("参数包含非法字符");
			}

			schoolQuery.setCollegeLevel(schoolLevel);
		}


		if(schoolCode2!=null&&!schoolCode2.equals("")) {

			if(isSpecialChar(schoolCode2.toString())||sqlValidate(schoolCode2.toString())){
				AjaxResult.error("参数包含非法字符");
			}

			schoolQuery.setScode(schoolCode2);
		}
*/

		if(schoolCodeInp!=null&&!schoolCodeInp.equals("")) {

			if(isSpecialChar(schoolCodeInp.toString())||sqlValidate(schoolCodeInp.toString())){
				AjaxResult.error("参数包含非法字符");
			}

			schoolQuery.setScode(schoolCodeInp);
		}

		if(schoolNameInp!=null&&!schoolNameInp.equals("")) {

			if(isSpecialChar(schoolNameInp.toString())||sqlValidate(schoolNameInp.toString())){
				AjaxResult.error("参数包含非法字符");
			}

			schoolQuery.setSname(schoolNameInp);
		}

		String schoolCode="";

		if(pageNum==null||pageNum.intValue()==0) pageNum=1;
		int pageRow=(pageNum-1)*10;

		schoolQuery.setPageNum(pageRow);
		List<School> list = schoolService.selectSchoolList4Page(schoolQuery);
		if(list!=null&&list.size()>0) {
			for(int i=0;i<list.size();i++) {
				School school=list.get(i);
				schoolCode=schoolCode+"'"+school.getScode()+"',";
			}
		}
		return  AjaxResult.success(list);

	}




	@ApiOperation("综合分析列表")
    @GetMapping("/zhfx_list")
    public AjaxResult zhfx_list(String pageType,String province,String schoolTypes,String schoolLevel,String schoolCode2,String batch,String userId,Integer pageNum,String schoolCodeInp,String schoolNameInp)
    {
    	System.out.println("--------zhfx_list----schoolTypes--"+schoolTypes+"-------schoolLevel----"+schoolLevel);
    	
    	if(userId==null||userId.equals("")) {
    		//userId="1786281642017542144";
    		return AjaxResult.error("请先登录");
    	}
    	
    	if(isSpecialChar(userId.toString())||sqlValidate(userId.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	BuzMember memberQuery=buzMemberService.selectBuzMemberById(userId);

    	if(memberQuery!=null&&memberQuery.getPhone()!=null) {
    		
    	}else {
    		
    		return AjaxResult.error("会员信息不存在，请先注册成为会员");
    	}
    	
        if(memberQuery.getSfvip().intValue()==0) {
        	return AjaxResult.error("系统已更新，非会员不能查询");
        }
        
//查找会员的同位分
        BuzMemberGrade memberGradeQuery=new BuzMemberGrade();
        memberGradeQuery.setMemberId(memberQuery.getId());
        List<BuzMemberGrade> memberGradeList=buzMemberGradeService.selectBuzMemberGradeList(memberGradeQuery);


        //查询专业组
        SchoolPlan schoolPlanQuery=new SchoolPlan();
        schoolPlanQuery.setYear(thisYear);
        if("物理".equals(memberQuery.getSxkm())) {
            schoolPlanQuery.setMajorType("理工类");
        }
        if("历史".equals(memberQuery.getSxkm())) {
            schoolPlanQuery.setMajorType("文史类");
        }

        //如果会员不是少数民族，则不能查询民族班
        if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
            schoolPlanQuery.setSsmzFlag(0);
        }

        if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
            schoolPlanQuery.setGjzxFlag(0);
        }

        if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
            schoolPlanQuery.setGxzxFlag(0);
        }

        schoolPlanQuery.setGrade(memberQuery.getGrade());

        //考生的再选科目
        schoolPlanQuery.setZxkm(memberQuery.getZxkm());

        if(province!=null&&!province.equals("")) {

            if(isSpecialChar(province.toString())||sqlValidate(province.toString())){
                AjaxResult.error("参数包含非法字符");
            }
            if(province.charAt(province.length()-1)==',') {
                province = province.substring(0, province.length() - 1);
            }
            schoolPlanQuery.setSprovince(province);
        }
/*
        if(provinceCode!=null&&!provinceCode.equals("")) {

            if(isSpecialChar(provinceCode.toString())||sqlValidate(provinceCode.toString())){
                AjaxResult.error("参数包含非法字符");
            }

            schoolPlanQuery.setSprovinceCode(provinceCode);
        }

 */

        if(schoolTypes!=null&&!schoolTypes.equals("")) {

            if(isSpecialChar(schoolTypes.toString())||sqlValidate(schoolTypes.toString())){
                AjaxResult.error("参数包含非法字符");
            }
            if(schoolTypes.charAt(schoolTypes.length()-1)==',') {
                schoolTypes = schoolTypes.substring(0, schoolTypes.length() - 1);
            }
            schoolPlanQuery.setStypes(schoolTypes);
        }

        if(pageType!=null&&!pageType.equals("")) {

            if(isSpecialChar(pageType.toString())||sqlValidate(pageType.toString())){
                AjaxResult.error("参数包含非法字符");
            }
            if(pageType.equals("c")) {
                schoolPlanQuery.setSubmitPageType(1);
            }
            if(pageType.equals("z")) {
                schoolPlanQuery.setSubmitPageType(2);
            }
            if(pageType.equals("w")) {
                schoolPlanQuery.setSubmitPageType(3);
            }
            if(pageType.equals("s")) {
                schoolPlanQuery.setSubmitPageType(4);
            }
            if(pageType.equals("b")) {
                schoolPlanQuery.setSubmitPageType(5);
            }
        }

        if(schoolCode2!=null&&!schoolCode2.equals("")) {

            if(isSpecialChar(schoolCode2.toString())||sqlValidate(schoolCode2.toString())){
                AjaxResult.error("参数包含非法字符");
            }

            schoolPlanQuery.setSchoolCode(schoolCode2);
        }

        if(schoolCodeInp!=null&&!schoolCodeInp.equals("")) {

            if(isSpecialChar(schoolCodeInp.toString())||sqlValidate(schoolCodeInp.toString())){
                AjaxResult.error("参数包含非法字符");
            }

            schoolPlanQuery.setSchoolCode(schoolCodeInp);
        }

        if(schoolNameInp!=null&&!schoolNameInp.equals("")) {

            if(isSpecialChar(schoolNameInp.toString())||sqlValidate(schoolNameInp.toString())){
                AjaxResult.error("参数包含非法字符");
            }

            schoolPlanQuery.setSchoolName(schoolNameInp);
        }

        if(schoolLevel!=null&&!schoolLevel.equals("")) {

            if(isSpecialChar(schoolLevel.toString())||sqlValidate(schoolLevel.toString())){
                AjaxResult.error("参数包含非法字符");
            }
            if(schoolLevel.charAt(schoolLevel.length()-1)==',') {
                schoolLevel = schoolLevel.substring(0, schoolLevel.length() - 1);
            }
            String[] schoolLevelArr=schoolLevel.split(",");
            String sqlStr="";
            for(int i=0;i<schoolLevelArr.length;i++){
                String str=schoolLevelArr[i];
                sqlStr=sqlStr+" c.college_level like '%"+str+"%' ";
                if(i<schoolLevelArr.length-1){
                    sqlStr=sqlStr+" or ";
                }
            }


            schoolPlanQuery.setCollegeLevel(sqlStr);
        }


        if(pageNum==null||pageNum.intValue()==0) pageNum=1;
        int pageRow=(pageNum-1)*10;

        schoolPlanQuery.setPageNum(pageRow);


        List<SchoolPlan> list =schoolPlanService.selectSchoolZyzPlanList4Page(schoolPlanQuery);


        List<SysDictData> data = dictTypeService.selectDictDataByType("school_level");


        String schoolCode="";
		String zyzStr="";
        if(list!=null&&list.size()>0) {
            for(int i=0;i<list.size();i++) {
                SchoolPlan school=list.get(i);
                schoolCode=schoolCode+"'"+school.getSchoolCode()+"',";
				zyzStr=zyzStr+"'"+school.getZyz()+"',";
            }
        }
        
        List<School> returnList =new ArrayList();
        
        if(!schoolCode.equals("")) {
        	schoolCode=schoolCode.substring(0, schoolCode.length()-1);
			zyzStr=zyzStr.substring(0, zyzStr.length()-1);

            schoolPlanQuery.setSchoolCode(schoolCode);
			schoolPlanQuery.setZyzStr(zyzStr);
            schoolPlanQuery.setYear3(yearNew1+","+yearNew2+","+yearNew3);
        	List<SchoolPlan> zyzList =schoolPlanService.selectSchoolZyzPlanList3Year(schoolPlanQuery);


			List<SchoolPlan> plans2024List =schoolPlanService.selectSchoolZyz2024PlanList(schoolPlanQuery);
        	
        	DecimalFormat df = new DecimalFormat("#.00");
        	//开始计算专业组投档率
        	for(int i=0;i<list.size();i++) {
        		SchoolPlan school=list.get(i);//一共有N个学校
        		String provinceName=school.getProvinceName();
        		


                School schoolRecord2022=new School();
                schoolRecord2022.setProvinceName(provinceName);
                schoolRecord2022.setSname(school.getSchoolName());
                schoolRecord2022.setScode(school.getSchoolCode());
                schoolRecord2022.setZyz(school.getZyz());
                if("物理".equals(memberQuery.getSxkm())) {
                    schoolRecord2022.setGradeLine(new Integer(gradeLineLg2022).toString());
                }else{
                    schoolRecord2022.setGradeLine(new Integer(gradeLineWs2022).toString());
                }

                schoolRecord2022.setYear(yearNew1);
                schoolRecord2022.setSranking(school.getSranking());
                schoolRecord2022.setZxkm(school.getKm2());

                String collegeLevel=school.getCollegeLevel();
                if(collegeLevel!=null){
                    String clStr="";
                    String[] collegeLevelArr=collegeLevel.split(",");
                    for(int t=0;t<collegeLevelArr.length;t++) {
                        String cl=collegeLevelArr[t];
                        for(int t2=0;t2<data.size();t2++){
                            SysDictData sd=data.get(t2);
                            if(cl.equals(sd.getDictValue())){
                                clStr=clStr+sd.getDictLabel()+",";
                            }
                        }
                    }
                    if(clStr.length()>0) clStr=clStr.substring(0,clStr.length()-1);
                    schoolRecord2022.setCollegeLevel(clStr);
                }

                /**
                 * 计算当年的排名和对应的分数
                 */
                if(provinceName.equals("广西")) {

                    if(memberGradeList!=null&&memberGradeList.size()>0){
                        for(int k=0;k<memberGradeList.size();k++){
                            BuzMemberGrade memberGrade=memberGradeList.get(k);
                            if(memberGrade.getYear().intValue()==yearNew1){
                                if(memberGrade.getPmGradeGx()!=null) {
                                    schoolRecord2022.setSeqGrade(memberGrade.getPmGradeGx().toString());
                                }else{
                                    schoolRecord2022.setSeqGrade("-");
                                }
                            }
                        }
                    }

                    if(memberQuery.getGradePmGx()!=null) {
                        schoolRecord2022.setSeq(memberQuery.getGradePmGx().toString());
                    }else{
                        schoolRecord2022.setSeq("-");
                    }
                }else {

                    if(memberGradeList!=null&&memberGradeList.size()>0){
                        for(int k=0;k<memberGradeList.size();k++){
                            BuzMemberGrade memberGrade=memberGradeList.get(k);
                            if(memberGrade.getYear().intValue()==yearNew1){
                                if(memberGrade.getPmGradeGx()!=null) {
                                    schoolRecord2022.setSeqGrade(memberGrade.getPmGrade().toString());
                                }else{
                                    schoolRecord2022.setSeqGrade("-");
                                }
                            }
                        }
                    }

                    if(memberQuery.getGradePm()!=null) {
                        schoolRecord2022.setSeq(memberQuery.getGradePm().toString());
                    }else{
                        schoolRecord2022.setSeq("-");
                    }

                }

                /**
                 * 计算当年最低分，最低分排名，平均分，平均分对应的排名
                 */
                SchoolPlan zyz2022=null;
                for(int k=0;k<zyzList.size();k++) {
                    SchoolPlan school3 = zyzList.get(k);
                    if (school3.getYear().intValue() == yearNew1 &&
                            school3.getSchoolCode().equals(school.getSchoolCode()) &&
                            school3.getZyz().equals(school.getZyz())) {
                        zyz2022=school3;
                        break;

                    }
                }
                if(zyz2022!=null){
                    if(zyz2022.getZyzAvgGrade()!=null){
                        schoolRecord2022.setAvgGrade(zyz2022.getZyzAvgGrade().toString());
                    }else{
                        schoolRecord2022.setAvgGrade("-");
                    }
                    if(zyz2022.getZyzLowGrade()!=null){
                        schoolRecord2022.setMinGrade(zyz2022.getZyzLowGrade().toString());
                    }else{
                        schoolRecord2022.setMinGrade("-");
                    }
                    if(zyz2022.getZyzLowPm()!=null){
                        schoolRecord2022.setMinGradeSeq(zyz2022.getZyzLowPm().toString());
                    }else{
                        schoolRecord2022.setMinGradeSeq("-");
                    }
                    if(zyz2022.getZyzAvgPm()!=null){
                        schoolRecord2022.setAvgGradeSeq(zyz2022.getZyzAvgPm().toString());
                    }else{
                        schoolRecord2022.setAvgGradeSeq("-");
                    }
                    String planSubmitAdmission="";
                    if(zyz2022.getZyzPlan()!=null){
                        schoolRecord2022.setPlan(zyz2022.getZyzPlan().toString());
                        planSubmitAdmission=zyz2022.getZyzPlan().toString();
                    }else{
                        schoolRecord2022.setPlan("-");
                    }
                    if(zyz2022.getZyzAdmin()!=null){
                        schoolRecord2022.setSubmit(zyz2022.getZyzAdmin().toString());
                        planSubmitAdmission=planSubmitAdmission+"-"+zyz2022.getZyzAdmin().toString();
                    }else{
                        schoolRecord2022.setSubmit("-");
                        if(zyz2022.getZyzPlan()!=null){
                            planSubmitAdmission=planSubmitAdmission+"-";
                        }
                    }
                    schoolRecord2022.setPlanSubmitAdmission(planSubmitAdmission);
                }else{
                    schoolRecord2022.setAvgGrade("-");
                    schoolRecord2022.setMinGrade("-");
                    schoolRecord2022.setAvgGradeSeq("-");
                    schoolRecord2022.setMinGradeSeq("-");
                    schoolRecord2022.setPlan("-");
                    schoolRecord2022.setSubmit("-");
                    schoolRecord2022.setPlanSubmitAdmission("-");
                }



                School schoolRecord2021=new School();
                schoolRecord2021.setProvinceName(provinceName);
                schoolRecord2021.setSname(school.getSchoolName());
                schoolRecord2021.setScode(school.getSchoolCode());
                schoolRecord2021.setZyz(school.getZyz());
                schoolRecord2021.setYear(yearNew2);
                schoolRecord2021.setSranking(school.getSranking());
                schoolRecord2021.setCollegeLevel(schoolRecord2022.getCollegeLevel());
                schoolRecord2021.setZxkm(school.getKm2());
                if("物理".equals(memberQuery.getSxkm())) {
                    schoolRecord2021.setGradeLine(new Integer(gradeLineLg2021).toString());
                }else{
                    schoolRecord2021.setGradeLine(new Integer(gradeLineWs2021).toString());
                }


                if(provinceName.equals("广西")) {
                    if(memberGradeList!=null&&memberGradeList.size()>0){
                        for(int k=0;k<memberGradeList.size();k++){
                            BuzMemberGrade memberGrade=memberGradeList.get(k);
                            if(memberGrade.getYear().intValue()==yearNew2){
                                if(memberGrade.getPmGradeGx()!=null) {
                                    schoolRecord2021.setSeqGrade(memberGrade.getPmGradeGx().toString());
                                }else{
                                    schoolRecord2021.setSeqGrade("-");
                                }
                            }
                        }
                    }

                    if(memberQuery.getGradePmGx()!=null) {
                        schoolRecord2021.setSeq(memberQuery.getGradePmGx().toString());
                    }else{
                        schoolRecord2021.setSeq("-");
                    }
                }else {

                    if(memberGradeList!=null&&memberGradeList.size()>0){
                        for(int k=0;k<memberGradeList.size();k++){
                            BuzMemberGrade memberGrade=memberGradeList.get(k);
                            if(memberGrade.getYear().intValue()==yearNew2){
                                if(memberGrade.getPmGradeGx()!=null) {
                                    schoolRecord2021.setSeqGrade(memberGrade.getPmGrade().toString());
                                }else{
                                    schoolRecord2021.setSeqGrade("-");
                                }
                            }
                        }
                    }

                    if(memberQuery.getGradePm()!=null) {
                        schoolRecord2021.setSeq(memberQuery.getGradePm().toString());
                    }else{
                        schoolRecord2021.setSeq("-");
                    }
                }



                /**
                 * 计算当年最低分，最低分排名，平均分，平均分对应的排名
                 */
                SchoolPlan zyz2021=null;
                for(int k=0;k<zyzList.size();k++) {
                    SchoolPlan school3 = zyzList.get(k);
                    if (school3.getYear().intValue() == yearNew2 &&
                            school3.getSchoolCode().equals(school.getSchoolCode()) &&
                            school3.getZyz().equals(school.getZyz())) {
                        zyz2021=school3;
                        break;

                    }
                }
                if(zyz2021!=null){
                    if(zyz2021.getZyzAvgGrade()!=null){
                        schoolRecord2021.setAvgGrade(zyz2021.getZyzAvgGrade().toString());
                    }else{
                        schoolRecord2021.setAvgGrade("-");
                    }
                    if(zyz2021.getZyzLowGrade()!=null){
                        schoolRecord2021.setMinGrade(zyz2021.getZyzLowGrade().toString());
                    }else{
                        schoolRecord2021.setMinGrade("-");
                    }
                    if(zyz2021.getZyzLowPm()!=null){
                        schoolRecord2021.setMinGradeSeq(zyz2021.getZyzLowPm().toString());
                    }else{
                        schoolRecord2021.setMinGradeSeq("-");
                    }
                    if(zyz2021.getZyzAvgPm()!=null){
                        schoolRecord2021.setAvgGradeSeq(zyz2021.getZyzAvgPm().toString());
                    }else{
                        schoolRecord2021.setAvgGradeSeq("-");
                    }
                    String planSubmitAdmission="";
                    if(zyz2021.getZyzPlan()!=null){
                        schoolRecord2021.setPlan(zyz2021.getZyzPlan().toString());
                        planSubmitAdmission=zyz2021.getZyzPlan().toString();
                    }else{
                        schoolRecord2021.setPlan("-");
                    }
                    if(zyz2021.getZyzAdmin()!=null){
                        schoolRecord2021.setSubmit(zyz2021.getZyzAdmin().toString());
                        planSubmitAdmission=planSubmitAdmission+"-"+zyz2021.getZyzAdmin().toString();
                    }else{
                        schoolRecord2021.setSubmit("-");
                        if(zyz2021.getZyzPlan()!=null){
                            planSubmitAdmission=planSubmitAdmission+"-";
                        }
                    }
                    schoolRecord2021.setPlanSubmitAdmission(planSubmitAdmission);
                }else{
                    schoolRecord2021.setAvgGrade("-");
                    schoolRecord2021.setMinGrade("-");
                    schoolRecord2021.setAvgGradeSeq("-");
                    schoolRecord2021.setMinGradeSeq("-");
                    schoolRecord2021.setPlan("-");
                    schoolRecord2021.setSubmit("-");
                    schoolRecord2021.setPlanSubmitAdmission("-");
                }



                School schoolRecord2020=new School();
                schoolRecord2020.setProvinceName(provinceName);
                schoolRecord2020.setSname(school.getSchoolName());
                schoolRecord2020.setScode(school.getSchoolCode());
                schoolRecord2020.setZyz(school.getZyz());
                schoolRecord2020.setYear(yearNew3);
                schoolRecord2020.setSranking(school.getSranking());
                schoolRecord2020.setCollegeLevel(schoolRecord2022.getCollegeLevel());
                schoolRecord2020.setZxkm(school.getKm2());
                if("物理".equals(memberQuery.getSxkm())) {
                    schoolRecord2020.setGradeLine(new Integer(gradeLineLg2020).toString());
                }else{
                    schoolRecord2020.setGradeLine(new Integer(gradeLineWs2020).toString());
                }

                if(provinceName.equals("广西")) {

                    if(memberGradeList!=null&&memberGradeList.size()>0){
                        for(int k=0;k<memberGradeList.size();k++){
                            BuzMemberGrade memberGrade=memberGradeList.get(k);
                            if(memberGrade.getYear().intValue()==yearNew3){
                                if(memberGrade.getPmGradeGx()!=null) {
                                    schoolRecord2020.setSeqGrade(memberGrade.getPmGradeGx().toString());
                                }else{
                                    schoolRecord2020.setSeqGrade("-");
                                }
                            }
                        }
                    }

                    if(memberQuery.getGradePmGx()!=null) {
                        schoolRecord2020.setSeq(memberQuery.getGradePmGx().toString());
                    }else{
                        schoolRecord2020.setSeq("-");
                    }
                }else {

                    if(memberGradeList!=null&&memberGradeList.size()>0){
                        for(int k=0;k<memberGradeList.size();k++){
                            BuzMemberGrade memberGrade=memberGradeList.get(k);
                            if(memberGrade.getYear().intValue()==yearNew3){
                                if(memberGrade.getPmGradeGx()!=null) {
                                    schoolRecord2020.setSeqGrade(memberGrade.getPmGrade().toString());
                                }else{
                                    schoolRecord2020.setSeqGrade("-");
                                }
                            }
                        }
                    }

                    if(memberQuery.getGradePm()!=null) {
                        schoolRecord2020.setSeq(memberQuery.getGradePm().toString());
                    }else{
                        schoolRecord2020.setSeq("-");
                    }

                }



                /**
                 * 计算当年最低分，最低分排名，平均分，平均分对应的排名
                 */
                SchoolPlan zyz2020=null;
                for(int k=0;k<zyzList.size();k++) {
                    SchoolPlan school3 = zyzList.get(k);
                    if (school3.getYear().intValue() == yearNew3 &&
                            school3.getSchoolCode().equals(school.getSchoolCode()) &&
                            school3.getZyz().equals(school.getZyz())) {
                        zyz2020=school3;
                        break;

                    }
                }
                if(zyz2020!=null){
                    if(zyz2020.getZyzAvgGrade()!=null){
                        schoolRecord2020.setAvgGrade(zyz2020.getZyzAvgGrade().toString());
                    }else{
                        schoolRecord2020.setAvgGrade("-");
                    }
                    if(zyz2020.getZyzLowGrade()!=null){
                        schoolRecord2020.setMinGrade(zyz2020.getZyzLowGrade().toString());
                    }else{
                        schoolRecord2020.setMinGrade("-");
                    }
                    if(zyz2020.getZyzLowPm()!=null){
                        schoolRecord2020.setMinGradeSeq(zyz2020.getZyzLowPm().toString());
                    }else{
                        schoolRecord2020.setMinGradeSeq("-");
                    }
                    if(zyz2020.getZyzAvgPm()!=null){
                        schoolRecord2020.setAvgGradeSeq(zyz2020.getZyzAvgPm().toString());
                    }else{
                        schoolRecord2020.setAvgGradeSeq("-");
                    }
                    String planSubmitAdmission="";
                    if(zyz2020.getZyzPlan()!=null){
                        schoolRecord2020.setPlan(zyz2020.getZyzPlan().toString());
                        planSubmitAdmission=zyz2020.getZyzPlan().toString();
                    }else{
                        schoolRecord2020.setPlan("-");
                    }
                    if(zyz2020.getZyzAdmin()!=null){
                        schoolRecord2020.setSubmit(zyz2020.getZyzAdmin().toString());
                        planSubmitAdmission=planSubmitAdmission+"-"+zyz2020.getZyzAdmin().toString();
                    }else{
                        schoolRecord2020.setSubmit("-");
                        if(zyz2020.getZyzPlan()!=null){
                            planSubmitAdmission=planSubmitAdmission+"-";
                        }
                    }
                    schoolRecord2020.setPlanSubmitAdmission(planSubmitAdmission);
                }else{
                    schoolRecord2020.setAvgGrade("-");
                    schoolRecord2020.setMinGrade("-");
                    schoolRecord2020.setAvgGradeSeq("-");
                    schoolRecord2020.setMinGradeSeq("-");
                    schoolRecord2020.setPlan("-");
                    schoolRecord2020.setSubmit("-");
                    schoolRecord2020.setPlanSubmitAdmission("-");
                }


                /**
                 * 专业组投档概率
                 * (考生成绩-录取最低分)/2+50
                 * double finalRate = (memberGrade - grade) / 2 + 50;
                 */
				SchoolPlan lowGradePlan2024=null;
				for(int s=0;s<plans2024List.size();s++) {
					SchoolPlan plan2024 = plans2024List.get(s);
					//学校和专业组相等
					//System.out.println("------------plan2024.getSchoolCode()--------"+plan2024.getSchoolCode()+"------schoolRecord2022.getScode()-----------"+schoolRecord2022.getScode()+"-------plan2024.getZyz()---"+plan2024.getZyz()+"-----schoolRecord2022.getZyz()---"+schoolRecord2022.getZyz()+"--");
					if (plan2024.getSchoolCode().equals(schoolRecord2022.getScode())
							&& plan2024.getZyz().equals(schoolRecord2022.getZyz())) {
						lowGradePlan2024=plan2024;
						break;
					}
				}
                if(provinceName.equals("广西")) {
                    int memberGrade=memberQuery.getGxgrade();
					if(lowGradePlan2024!=null){
						int grade=lowGradePlan2024.getGrade();
						float cha= (float)(memberGrade - grade) / 2;
						if(cha>0) cha=cha+1;
						if(cha<0) cha=cha-1;
						double finalRate = cha + 50;

						if(finalRate>=100) finalRate=99.99;
						if(finalRate<1) finalRate=1;

						if(schoolRecord2022.getMinGrade()!=null&&!schoolRecord2022.getMinGrade().equals("-")
							&&schoolRecord2022.getAvgGrade()!=null&&!schoolRecord2022.getAvgGrade().equals("-")){
							schoolRecord2020.setSubmitRate(df.format(finalRate));
							schoolRecord2021.setSubmitRate(df.format(finalRate));
							schoolRecord2022.setSubmitRate(df.format(finalRate));
						}else{
							schoolRecord2020.setSubmitRate("-");
							schoolRecord2021.setSubmitRate("-");
							schoolRecord2022.setSubmitRate("-");
						}

					}else{
						schoolRecord2020.setSubmitRate("-");
						schoolRecord2021.setSubmitRate("-");
						schoolRecord2022.setSubmitRate("-");
					}
                }else{
                    int memberGrade=memberQuery.getQggrade();

					if(lowGradePlan2024!=null){
						int grade=lowGradePlan2024.getGrade();
						float cha= (float)(memberGrade - grade) / 2;
						if(cha>0) cha=cha+1;
						if(cha<0) cha=cha-1;
						double finalRate = cha + 50;

						if(finalRate>=100) finalRate=99.99;
						if(finalRate<1) finalRate=1;

						if(schoolRecord2022.getMinGrade()!=null&&!schoolRecord2022.getMinGrade().equals("-")
								&&schoolRecord2022.getAvgGrade()!=null&&!schoolRecord2022.getAvgGrade().equals("-")){
							schoolRecord2020.setSubmitRate(df.format(finalRate));
							schoolRecord2021.setSubmitRate(df.format(finalRate));
							schoolRecord2022.setSubmitRate(df.format(finalRate));
						}else{
							schoolRecord2020.setSubmitRate("-");
							schoolRecord2021.setSubmitRate("-");
							schoolRecord2022.setSubmitRate("-");
						}
					}else{
						schoolRecord2020.setSubmitRate("-");
						schoolRecord2021.setSubmitRate("-");
						schoolRecord2022.setSubmitRate("-");
					}
                }


                returnList.add(schoolRecord2022);
                returnList.add(schoolRecord2021);
                returnList.add(schoolRecord2020);
        		
        		
        	}
        			
        }
        return AjaxResult.success(getDataTable(returnList));
    }
    
    
    @ApiOperation("专科综合分析列表")
    @GetMapping("/zhfx_list_zk")
    public AjaxResult zhfx_list_zk(String province,String schoolTypes,String schoolLevel,String schoolCode2,String batch,String userId,Integer pageNum,String schoolCodeInp,String schoolNameInp)
    {
    	//System.out.println("--------province------"+province);
    	
    	if(userId==null||userId.equals("")) {
    		//userId="1786281642017542144";
    		return AjaxResult.error("请先登录");
    	}
    	
    	if(isSpecialChar(userId.toString())||sqlValidate(userId.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	BuzMember memberQuery=buzMemberService.selectBuzMemberById(userId);

    	if(memberQuery!=null&&memberQuery.getPhone()!=null) {
    		
    	}else {
    		
    		return AjaxResult.error("会员信息不存在，请先注册成为会员");
    	}
    	
        if(memberQuery.getSfvip().intValue()==0) {
        	return AjaxResult.error("系统已更新，非会员不能查询");
        }
        
        /****
         * 1、查找满足条件的学校
         * 2、获取每个学校的专业组
         * 3、需要根据考生是文科还是理科，根据公式，计算投档率
         */
        
        School schoolQuery=new School();
        if(province!=null&&!province.equals("")) {
        	
        	if(isSpecialChar(province.toString())||sqlValidate(province.toString())){
        		AjaxResult.error("参数包含非法字符");
        	}
        	
        	schoolQuery.setSprovince(new Long(province));
        }
        
        if(schoolTypes!=null&&!schoolTypes.equals("")) {
        	
        	if(isSpecialChar(schoolTypes.toString())||sqlValidate(schoolTypes.toString())){
        		AjaxResult.error("参数包含非法字符");
        	}
        	
        	schoolQuery.setStypes(schoolTypes);
        }
        
        if(schoolLevel!=null&&!schoolLevel.equals("")) {
        	
        	if(isSpecialChar(schoolLevel.toString())||sqlValidate(schoolLevel.toString())){
        		AjaxResult.error("参数包含非法字符");
        	}
        	
        	schoolQuery.setCollegeLevel(schoolLevel);
        }
        
        
        if(schoolCode2!=null&&!schoolCode2.equals("")) {
        	
        	if(isSpecialChar(schoolCode2.toString())||sqlValidate(schoolCode2.toString())){
        		AjaxResult.error("参数包含非法字符");
        	}
        	
        	schoolQuery.setScode(schoolCode2);
        }
        
		if(schoolCodeInp!=null&&!schoolCodeInp.equals("")) {
		        	
		        	if(isSpecialChar(schoolCodeInp.toString())||sqlValidate(schoolCodeInp.toString())){
		        		AjaxResult.error("参数包含非法字符");
		        	}
		        	
		        	schoolQuery.setScode(schoolCodeInp);
		        }
		
		if(schoolNameInp!=null&&!schoolNameInp.equals("")) {
			
			if(isSpecialChar(schoolNameInp.toString())||sqlValidate(schoolNameInp.toString())){
				AjaxResult.error("参数包含非法字符");
			}
			
			schoolQuery.setSname(schoolNameInp);
		}
        
        
        if("物理".equals(memberQuery.getSxkm())) {
        	schoolQuery.setMajorType("理工类");
    	}
    	if("历史".equals(memberQuery.getSxkm())) {
    		schoolQuery.setMajorType("文史类");
    	}
    	
    	
    	//如果会员不是少数民族，则不能查询民族班
    	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
    		schoolQuery.setSsmzFlag(0);
    	}
    	
    	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
    		schoolQuery.setGjzxFlag(0);
    	}
    	
    	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
    		schoolQuery.setGxzxFlag(0);
    	}
    	
    	
    	//考生的再选科目
    	schoolQuery.setZxkm(memberQuery.getZxkm());    	
        
        String schoolCode="";
        
        if(pageNum==null||pageNum.intValue()==0) pageNum=1;
        int pageRow=(pageNum-1)*10;
        
        schoolQuery.setPageNum(pageRow);
        
        List<School> list = schoolService.selectSchoolList4Page(schoolQuery);
        if(list!=null&&list.size()>0) {
        	for(int i=0;i<list.size();i++) {
        		School school=list.get(i);
        		schoolCode=schoolCode+"'"+school.getScode()+"',";
        	}
        }
        
        List<School> returnList =new ArrayList();
        
        if(!schoolCode.equals("")) {
        	schoolCode=schoolCode.substring(0, schoolCode.length()-1);
        	//查询专业组
        	SchoolPlan schoolPlanQuery=new SchoolPlan();
        	schoolPlanQuery.setYear(thisYear);
        	schoolPlanQuery.setSchoolCode(schoolCode);
        	if("物理".equals(memberQuery.getSxkm())) {
        		schoolPlanQuery.setMajorType("理工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		schoolPlanQuery.setMajorType("文史类");
        	}
        	
        	//如果会员不是少数民族，则不能查询民族班
        	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
        		schoolPlanQuery.setSsmzFlag(0);
        	}
        	
        	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
        		schoolPlanQuery.setGjzxFlag(0);
        	}
        	
        	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
        		schoolPlanQuery.setGxzxFlag(0);
        	}
        	
        	//考生的再选科目
        	schoolPlanQuery.setZxkm(memberQuery.getZxkm());
        	
        	
        	List<SchoolPlan> zyzList =schoolPlanService.selectSchoolZyzPlanList(schoolPlanQuery);
        	
        	//List<SchoolPlan> zyzList =schoolPlanService.selectSchoolZyzList(schoolPlanQuery);
        	
        	List<SchoolPlan> plans2023List =schoolPlanService.selectSchoolZyz2023PlanList(schoolPlanQuery);
        	
        	//查询各个专业组近3年的平均分、最低分（当前计算，先以2020,2021,2022这3年的录取数据为模拟数据）
        	SchoolMajorYearAdmission schoolMajorYearAdmission=new SchoolMajorYearAdmission();
        	schoolMajorYearAdmission.setYear(thisYear);
        	schoolMajorYearAdmission.setsCode(schoolCode);
        	if("物理".equals(memberQuery.getSxkm())) {
        		schoolMajorYearAdmission.setMajorType("理工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		schoolMajorYearAdmission.setMajorType("文史类");
        	}
        	
        	//如果会员不是少数民族，则不能查询民族班
        	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
        		schoolMajorYearAdmission.setSsmzFlag(0);
        	}
        	
        	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
        		schoolMajorYearAdmission.setGjzxFlag(0);
        	}
        	
        	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
        		schoolMajorYearAdmission.setGxzxFlag(0);
        	}
        	
        	//考生的再选科目
        	schoolMajorYearAdmission.setZxkm(memberQuery.getZxkm());
        	
        	List<SchoolMajorYearAdmission> zyzGradeList=schoolMajorYearAdmissionService.selectSchoolZyzYearAdmissionList(schoolMajorYearAdmission);
        	
        	
        	
        	/***
        	 * 2024年的分数为a，2023年的院校录取最低分为b,a-b除2—再加50%等于院校专业组投档概率。2024年的分数为c，2023年的专业录取最低分为d,c-d除2—再加50%等于院校专业录取概率。
        	 */
        	
        	
        	
        	
        	//查询历年一分一档，用于计算平均分排位和最低分排位
        	GkGradeDoc hisGkGradeDoc=new GkGradeDoc();
        	if("物理".equals(memberQuery.getSxkm())) {
        		hisGkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		hisGkGradeDoc.setGradeClass("史类");
        	}
        	
        	List<GkGradeDoc> hisPwGradeList=gkGradeDocService.selectGkGradeDocList(hisGkGradeDoc);
        	
        	
        	
        	//查询当年考生的排位(先用2023年的一分一档)，拿到2023年该分数的排位，取出2022、2021、2020年的同位分
        	int gxpw=99999999;
        	
        	//广西排位分
        	GkGradeDoc gkGradeDoc=new GkGradeDoc();
        	gkGradeDoc.setGrade(memberQuery.getGxgrade());
        	gkGradeDoc.setYear(gradeLineYear);
        	if("物理".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("史类");
        	}
        	List<GkGradeDoc> gradeList=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);
        	
        	for(int z=0;z<gradeList.size();z++) {
        		GkGradeDoc gradeDoc=gradeList.get(z);
        		if(gradeDoc.getUseIn().equals("广西")) {
        			gxpw=gradeDoc.getSeq();
        		}
        	}
        	
        	//查找近3年的广西同位分
        	gkGradeDoc=new GkGradeDoc();
        	if("物理".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("史类");
        	}
        	gkGradeDoc.setUseIn("广西");
        	gkGradeDoc.setSeq(gxpw);
        	List<GkGradeDoc> gxpwGradeList=gkGradeDocService.selectGkGradeDocListBySeq(gkGradeDoc);
        	List<GkGradeDoc> gxLastPwGradeList=gkGradeDocService.selectGkGradeDocLastRecordList(gkGradeDoc);//最后一名的排位和成绩
        	
        	
        	
        	
        	
        	
        	int qgpw=99999999;
        	
        	
        	int temp_qgjfpw=99999999;//全国加分的排位(认可加分)
        	int temp_qgpw=99999999;//全国加分的排位(不认可加分)
        	
        	
        	//全国认可加分排位分
        	gkGradeDoc=new GkGradeDoc();
        	gkGradeDoc.setGrade(memberQuery.getQggrade());
        	
        	gkGradeDoc.setYear(2024);
        	if("物理".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("史类");
        	}
        	List<GkGradeDoc> gradeList2=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);
        	
        	for(int z=0;z<gradeList2.size();z++) {
        		GkGradeDoc gradeDoc=gradeList2.get(z);
        		
        		if(gradeDoc.getUseIn().equals("全国")) {
        			temp_qgjfpw=gradeDoc.getSeq();//认可加分的排位分
        		}
        	}
        	
        	//全国不认可加分排位分
        	gkGradeDoc=new GkGradeDoc();
        	gkGradeDoc.setGrade(memberQuery.getGrade());
        	
        	gkGradeDoc.setYear(2024);
        	if("物理".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("史类");
        	}
        	List<GkGradeDoc> gradeList3=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);
        	
        	for(int z=0;z<gradeList3.size();z++) {
        		GkGradeDoc gradeDoc=gradeList3.get(z);
        		
        		if(gradeDoc.getUseIn().equals("全国")) {
        			temp_qgpw=gradeDoc.getSeq();//认可加分的排位分
        		}
        	}
        	
        	//查找进3年的全国同位分（认可加分的排位）
        	gkGradeDoc=new GkGradeDoc();
        	if("物理".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("史类");
        	}
        	gkGradeDoc.setUseIn("全国");
        	gkGradeDoc.setSeq(temp_qgjfpw);
        	List<GkGradeDoc> qgpwGradeList=gkGradeDocService.selectGkGradeDocListBySeq(gkGradeDoc);
        	List<GkGradeDoc> qgLastPwGradeList=gkGradeDocService.selectGkGradeDocLastRecordList(gkGradeDoc);//最后一名的排位和成绩
        	
        	
        	//不认可加分的排位
        	gkGradeDoc.setSeq(temp_qgpw);
        	List<GkGradeDoc> qgpwNoAddGradeList=gkGradeDocService.selectGkGradeDocListBySeq(gkGradeDoc);
        	
        	
        	
        	
        	DecimalFormat df = new DecimalFormat("#.00");
        	//开始计算专业组投档率
        	for(int i=0;i<list.size();i++) {
        		School school=list.get(i);//一共有N个学校
        		String provinceName=school.getProvinceName();
        		
        		
        		boolean qgjfFlag=true;//是否认可全国加分
            	if(school.getRemark()!=null) {
            		if(school.getRemark().indexOf("不认可加分")>-1) {//该学校不认可加分，则全国分只取高考分
            			qgjfFlag=false;
            		}
            	}
        		
        		
            	//查找近3年的广西排位
            	int gxj2022=0;
            	int gxj2021=0;
            	int gxj2020=0;
            	for(int z=0;z<gxpwGradeList.size();z++) {
            		GkGradeDoc gxGradeDoc=gxpwGradeList.get(z);
            		if(gxGradeDoc.getYear().intValue()==yearNew1) {
            			gxj2022=gxGradeDoc.getGrade();
            		}
            		if(gxGradeDoc.getYear().intValue()==yearNew2) {
            			gxj2021=gxGradeDoc.getGrade();
            		}
            		if(gxGradeDoc.getYear().intValue()==yearNew3) {
            			gxj2020=gxGradeDoc.getGrade();
            		}
            	}
        		if(gxj2022==0) {
        			for(int z=0;z<gxLastPwGradeList.size();z++) {
        				GkGradeDoc gxGradeDoc=gxLastPwGradeList.get(z);
                		if(gxGradeDoc.getYear().intValue()==yearNew1) {
                			gxj2022=gxGradeDoc.getGrade();
                		}
        			}
        		}
        		if(gxj2021==0) {
        			for(int z=0;z<gxLastPwGradeList.size();z++) {
        				GkGradeDoc gxGradeDoc=gxLastPwGradeList.get(z);
                		if(gxGradeDoc.getYear().intValue()==yearNew2) {
                			gxj2021=gxGradeDoc.getGrade();
                		}
        			}
        		}
        		if(gxj2020==0) {
        			for(int z=0;z<gxLastPwGradeList.size();z++) {
        				GkGradeDoc gxGradeDoc=gxLastPwGradeList.get(z);
                		if(gxGradeDoc.getYear().intValue()==yearNew3) {
                			gxj2020=gxGradeDoc.getGrade();
                		}
        			}
        		}
        		
        		
        		
        		int qgj2022=0;//近3年全国不加分的排位分
            	int qgj2021=0;
            	int qgj2020=0;
            	if(qgjfFlag) {//认可加分
            		qgpw=temp_qgjfpw;
            		for(int z=0;z<qgpwGradeList.size();z++) {
                		GkGradeDoc gxGradeDoc=qgpwGradeList.get(z);
                		if(gxGradeDoc.getYear().intValue()==yearNew1) {
                			qgj2022=gxGradeDoc.getGrade();
                		}
                		if(gxGradeDoc.getYear().intValue()==yearNew2) {
                			qgj2021=gxGradeDoc.getGrade();
                		}
                		if(gxGradeDoc.getYear().intValue()==yearNew3) {
                			qgj2020=gxGradeDoc.getGrade();
                		}
                	}
            	}else {//不认可加分
            		qgpw=temp_qgpw;
            		for(int z=0;z<qgpwNoAddGradeList.size();z++) {
                		GkGradeDoc gxGradeDoc=qgpwNoAddGradeList.get(z);
                		if(gxGradeDoc.getYear().intValue()==yearNew1) {
                			qgj2022=gxGradeDoc.getGrade();
                		}
                		if(gxGradeDoc.getYear().intValue()==yearNew2) {
                			qgj2021=gxGradeDoc.getGrade();
                		}
                		if(gxGradeDoc.getYear().intValue()==yearNew3) {
                			qgj2020=gxGradeDoc.getGrade();
                		}
                	}
            	}
        		
        		if(qgj2022==0) {
        			for(int z=0;z<qgLastPwGradeList.size();z++) {
                		GkGradeDoc gxGradeDoc=qgLastPwGradeList.get(z);
                		if(gxGradeDoc.getYear().intValue()==yearNew1) {
                			qgj2022=gxGradeDoc.getGrade();
                		}                		
                	}
        		}
        		
        		if(qgj2021==0) {
        			for(int z=0;z<qgLastPwGradeList.size();z++) {
                		GkGradeDoc gxGradeDoc=qgLastPwGradeList.get(z);
                		if(gxGradeDoc.getYear().intValue()==yearNew2) {
                			qgj2021=gxGradeDoc.getGrade();
                		}                		
                	}
        		}
        		
        		if(qgj2020==0) {
        			for(int z=0;z<qgLastPwGradeList.size();z++) {
                		GkGradeDoc gxGradeDoc=qgLastPwGradeList.get(z);
                		if(gxGradeDoc.getYear().intValue()==yearNew3) {
                			qgj2020=gxGradeDoc.getGrade();
                		}                		
                	}
        		}
        		
        		
        		for(int k=0;k<zyzList.size();k++) {
        			SchoolPlan zyzPlan=zyzList.get(k);//取出该学校的专业组
        			if(zyzPlan.getSchoolCode().equals(school.getScode())){
        				String zyz=zyzPlan.getZyz();
        				
        				
        				int avgGrade2022=0;
        				int minGrade2022=0;
        				int avgGrade2021=0;
        				int minGrade2021=0;
        				int avgGrade2020=0;
        				int minGrade2020=0;
        				
        				//历史招生数量，从指南取
        				int plan2022=0;
        				int submit2022=0;
        				int adm2022=0;
        				int plan2021=0;
        				int submit2021=0;
        				int adm2021=0;
        				int plan2020=0;
        				int submit2020=0;
        				int adm2020=0;
        				
        				//当年招生数量，从招生计划取
        				int plan2023=0;
        				
        				School schoolRecord2022=new School();
        				schoolRecord2022.setProvinceName(provinceName);
        				schoolRecord2022.setSname(school.getSname());
						schoolRecord2022.setScode(school.getScode());
        				schoolRecord2022.setZyz(zyz);
        				schoolRecord2022.setScode(school.getScode());
        				schoolRecord2022.setZxkm(zyzPlan.getKm2());
        				schoolRecord2022.setYear(yearNew1);
        				schoolRecord2022.setSranking(school.getSranking());
        				
        				
        				
        				if(provinceName.equals("广西")) {
        					schoolRecord2022.setSeqGrade(new Integer(gxj2022).toString());
        					schoolRecord2022.setSeq(new Integer(gxpw).toString());
        				}else {
        					schoolRecord2022.setSeqGrade(new Integer(qgj2022).toString());
        					schoolRecord2022.setSeq(new Integer(qgpw).toString());
        				}
        				
        				
        				
        				//设置分数线
        				if("物理".equals(memberQuery.getSxkm())) {
        					schoolRecord2022.setGradeLine(new Integer(gradeLineLg2022).toString());
        				}
        				if("历史".equals(memberQuery.getSxkm())) {
        					schoolRecord2022.setGradeLine(new Integer(gradeLineWs2022).toString());
        				}
        				
        				SchoolMajorYearAdmission admission2022=null;
        				SchoolMajorYearAdmission admission2021=null;
        				SchoolMajorYearAdmission admission2020=null;
        				for(int j=0;j<zyzGradeList.size();j++) {
        					SchoolMajorYearAdmission admission=zyzGradeList.get(j);
        					String zyzAdmin=admission.getZyz();
        					
        					if(zyz.equals(zyzAdmin)&&admission.getsCode().equals(zyzPlan.getSchoolCode())) {//同一个学校的专业组        						
        						if(admission.getYear()==yearNew1) {
        							admission2022=admission;
        						}
        						if(admission.getYear()==yearNew2) {
        							admission2021=admission;
        						}
        						if(admission.getYear()==yearNew3) {
        							admission2020=admission;
        						}
        					}
        				}
        				if(admission2022!=null&&admission2022.getAvgGrade()!=null) {
        					schoolRecord2022.setAvgGrade(admission2022.getAvgGrade().toString());
        					schoolRecord2022.setMinGrade(admission2022.getLowGrade().toString());
        					avgGrade2022=admission2022.getAvgGrade();
        					minGrade2022=admission2022.getLowGrade();
        					
        					//计算平均分排位，最低分排位
        					int avgGrade2022Seq=99999999;
        					int lastSeq=1;
        					for(int m=0;m<hisPwGradeList.size();m++) {
        						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
        						if(hisGradeDoc.getYear().intValue()==yearNew1) {
        							
        							
        							int myGrade=hisGradeDoc.getGrade();
        							
        							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
        								if(hisGradeDoc.getUseIn().equals("广西")) {
        									int fencha=myGrade-avgGrade2022;
        									if(fencha==0) {
        										avgGrade2022Seq=hisGradeDoc.getSeq();
        										break;
        									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
        										avgGrade2022Seq=lastSeq;
        										break;
        									}
        									
        									lastSeq=hisGradeDoc.getSeq();
        									
        								}
        							}else {
        								if(hisGradeDoc.getUseIn().equals("全国")) {
        									int fencha=myGrade-avgGrade2022;
        									if(fencha==0) {
        										avgGrade2022Seq=hisGradeDoc.getSeq();
        										break;
        									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
        										avgGrade2022Seq=lastSeq;
        										break;
        									}
        									
        									lastSeq=hisGradeDoc.getSeq();
        								}
        							}
        							
        						}
        					}
        					
        					schoolRecord2022.setAvgGradeSeq(new Integer(avgGrade2022Seq).toString());
        					
        					
        					int minGrade2022Seq=99999999;
        					lastSeq=1;
        					for(int m=0;m<hisPwGradeList.size();m++) {
        						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
        						if(hisGradeDoc.getYear().intValue()==yearNew1) {
        							
        							
        							int myGrade=hisGradeDoc.getGrade();
        							
        							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
        								if(hisGradeDoc.getUseIn().equals("广西")) {
        									int fencha=myGrade-minGrade2022;
        									if(fencha==0) {
        										minGrade2022Seq=hisGradeDoc.getSeq();
        										break;
        									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
        										minGrade2022Seq=lastSeq;
        										break;
        									}
        									
        									lastSeq=hisGradeDoc.getSeq();
        									
        								}
        							}else {
        								if(hisGradeDoc.getUseIn().equals("全国")) {
        									int fencha=myGrade-minGrade2022;
        									if(fencha==0) {
        										minGrade2022Seq=hisGradeDoc.getSeq();
        										break;
        									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
        										minGrade2022Seq=lastSeq;
        										break;
        									}
        									
        									lastSeq=hisGradeDoc.getSeq();
        								}
        							}
        							
        						}
        					}
        					
        					schoolRecord2022.setAvgGradeSeq(new Integer(avgGrade2022Seq).toString());
        					schoolRecord2022.setMinGradeSeq(new Integer(minGrade2022Seq).toString());
        					
        					
        					
        					
        					
        				}else {
        					schoolRecord2022.setAvgGrade("-");
        					schoolRecord2022.setMinGrade("-");
        					schoolRecord2022.setAvgGradeSeq("-");
        					schoolRecord2022.setMinGradeSeq("-");
        				}
        				if(admission2022!=null) {
	        				plan2022=admission2022.getPlan();
	    					if(admission2022.getSubmit()!=null) {
	    						submit2022=admission2022.getSubmit();
	    					}
	    					adm2022=admission2022.getAdmission();
	    					schoolRecord2022.setPlanSubmitAdmission(plan2022+"-"+adm2022);
        				}
        				
        				
        				for(int j=0;j<plans2023List.size();j++) {
        					SchoolPlan schoolPlan2023=plans2023List.get(j);
        					if(zyz.equals(schoolPlan2023.getZyz())&&zyzPlan.getSchoolCode().equals(schoolPlan2023.getSchoolCode())) {//同一个学校的专业组        	
        						plan2023=schoolPlan2023.getMajorPlan();
        					}
        				}
        				
        				
        				School schoolRecord2021=new School();
        				schoolRecord2021.setProvinceName(provinceName);
        				schoolRecord2021.setSname(school.getSname());
        				schoolRecord2021.setScode(school.getScode());
        				schoolRecord2021.setZyz(zyz);
        				schoolRecord2021.setZxkm(zyzPlan.getKm2());
        				schoolRecord2021.setYear(yearNew2);
        				schoolRecord2021.setSranking(school.getSranking());
        				
        				
        				if(provinceName.equals("广西")) {
        					schoolRecord2021.setSeqGrade(new Integer(gxj2021).toString());
        					schoolRecord2021.setSeq(new Integer(gxpw).toString());
        				}else {
        					schoolRecord2021.setSeqGrade(new Integer(qgj2021).toString());
        					schoolRecord2021.setSeq(new Integer(qgpw).toString());
        				}
        				
        				
        				//设置分数线
        				if("物理".equals(memberQuery.getSxkm())) {
        					schoolRecord2021.setGradeLine(new Integer(gradeLineLg2021).toString());
        				}
        				if("历史".equals(memberQuery.getSxkm())) {
        					schoolRecord2021.setGradeLine(new Integer(gradeLineWs2021).toString());
        				}
        				
        				if(admission2021!=null&&admission2021.getAvgGrade()!=null) {
        					schoolRecord2021.setAvgGrade(admission2021.getAvgGrade().toString());
        					schoolRecord2021.setMinGrade(admission2021.getLowGrade().toString());
        					avgGrade2021=admission2021.getAvgGrade();
        					minGrade2021=admission2021.getLowGrade();
        					
        					
        					
        					
        					
        					//计算平均分排位，最低分排位
        					int avgGrade2021Seq=99999999;
        					int lastSeq=1;
        					for(int m=0;m<hisPwGradeList.size();m++) {
        						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
        						if(hisGradeDoc.getYear().intValue()==yearNew2) {
        							
        							
        							int myGrade=hisGradeDoc.getGrade();
        							
        							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
        								if(hisGradeDoc.getUseIn().equals("广西")) {
        									int fencha=myGrade-avgGrade2021;
        									if(fencha==0) {
        										avgGrade2021Seq=hisGradeDoc.getSeq();
        										break;
        									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
        										avgGrade2021Seq=lastSeq;
        										break;
        									}
        									
        									lastSeq=hisGradeDoc.getSeq();
        									
        								}
        							}else {
        								if(hisGradeDoc.getUseIn().equals("全国")) {
        									int fencha=myGrade-avgGrade2021;
        									if(fencha==0) {
        										avgGrade2021Seq=hisGradeDoc.getSeq();
        										break;
        									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
        										avgGrade2021Seq=lastSeq;
        										break;
        									}
        									
        									lastSeq=hisGradeDoc.getSeq();
        								}
        							}
        							
        						}
        					}
        					
        					schoolRecord2021.setAvgGradeSeq(new Integer(avgGrade2021Seq).toString());
        					
        					
        					int minGrade2021Seq=99999999;
        					lastSeq=1;
        					for(int m=0;m<hisPwGradeList.size();m++) {
        						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
        						if(hisGradeDoc.getYear().intValue()==yearNew2) {
        							
        							
        							int myGrade=hisGradeDoc.getGrade();
        							
        							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
        								if(hisGradeDoc.getUseIn().equals("广西")) {
        									int fencha=myGrade-minGrade2021;
        									if(fencha==0) {
        										minGrade2021Seq=hisGradeDoc.getSeq();
        										break;
        									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
        										minGrade2021Seq=lastSeq;
        										break;
        									}
        									
        									lastSeq=hisGradeDoc.getSeq();
        									
        								}
        							}else {
        								if(hisGradeDoc.getUseIn().equals("全国")) {
        									int fencha=myGrade-minGrade2021;
        									if(fencha==0) {
        										minGrade2021Seq=hisGradeDoc.getSeq();
        										break;
        									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
        										minGrade2021Seq=lastSeq;
        										break;
        									}
        									
        									lastSeq=hisGradeDoc.getSeq();
        								}
        							}
        							
        						}
        					}
        					
        					schoolRecord2021.setAvgGradeSeq(new Integer(avgGrade2021Seq).toString());
        					schoolRecord2021.setMinGradeSeq(new Integer(minGrade2021Seq).toString());
        					
        					
        					
        					
        					
        				}else {
        					schoolRecord2021.setAvgGrade("-");
        					schoolRecord2021.setMinGrade("-");
        					schoolRecord2021.setAvgGradeSeq("-");
        					schoolRecord2021.setMinGradeSeq("-");
        				}
        				if(admission2021!=null) {
	        				plan2021=admission2021.getPlan();
	    					if(admission2021.getSubmit()!=null) {
	    						submit2021=admission2021.getSubmit();
	    					}
	    					adm2021=admission2021.getAdmission();
	    					schoolRecord2021.setPlanSubmitAdmission(plan2021+"-"+adm2021);
        				}
        				
        				
        				School schoolRecord2020=new School();
        				schoolRecord2020.setProvinceName(provinceName);
        				schoolRecord2020.setSname(school.getSname());
        				schoolRecord2020.setScode(school.getScode());
        				schoolRecord2020.setZyz(zyz);
        				schoolRecord2020.setZxkm(zyzPlan.getKm2());
        				schoolRecord2020.setYear(yearNew3);
        				schoolRecord2020.setSranking(school.getSranking());
        				
        				
        				if(provinceName.equals("广西")) {
        					schoolRecord2020.setSeqGrade(new Integer(gxj2020).toString());
        					schoolRecord2020.setSeq(new Integer(gxpw).toString());
        				}else {
        					schoolRecord2020.setSeqGrade(new Integer(qgj2020).toString());
        					schoolRecord2020.setSeq(new Integer(qgpw).toString());
        				}
        				
        				
        				//设置分数线
        				if("物理".equals(memberQuery.getSxkm())) {
        					schoolRecord2020.setGradeLine(new Integer(gradeLineLg2020).toString());
        				}
        				if("历史".equals(memberQuery.getSxkm())) {
        					schoolRecord2020.setGradeLine(new Integer(gradeLineWs2020).toString());
        				}
        				
        				if(admission2020!=null&&admission2020.getAvgGrade()!=null) {
        					schoolRecord2020.setAvgGrade(admission2020.getAvgGrade().toString());
        					schoolRecord2020.setMinGrade(admission2020.getLowGrade().toString());
        					avgGrade2020=admission2020.getAvgGrade();
        					minGrade2020=admission2020.getLowGrade();        
        					
        					
        					
        					//计算平均分排位，最低分排位
        					int avgGrade2020Seq=99999999;
        					int lastSeq=1;
        					for(int m=0;m<hisPwGradeList.size();m++) {
        						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
        						if(hisGradeDoc.getYear().intValue()==yearNew3) {
        							
        							
        							int myGrade=hisGradeDoc.getGrade();
        							
        							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
        								if(hisGradeDoc.getUseIn().equals("广西")) {
        									int fencha=myGrade-avgGrade2020;
        									if(fencha==0) {
        										avgGrade2020Seq=hisGradeDoc.getSeq();
        										break;
        									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
        										avgGrade2020Seq=lastSeq;
        										break;
        									}
        									
        									lastSeq=hisGradeDoc.getSeq();
        									
        								}
        							}else {
        								if(hisGradeDoc.getUseIn().equals("全国")) {
        									int fencha=myGrade-avgGrade2020;
        									if(fencha==0) {
        										avgGrade2020Seq=hisGradeDoc.getSeq();
        										break;
        									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
        										avgGrade2020Seq=lastSeq;
        										break;
        									}
        									
        									lastSeq=hisGradeDoc.getSeq();
        								}
        							}
        							
        						}
        					}
        					
        					schoolRecord2020.setAvgGradeSeq(new Integer(avgGrade2020Seq).toString());
        					
        					
        					int minGrade2020Seq=99999999;
        					lastSeq=1;
        					for(int m=0;m<hisPwGradeList.size();m++) {
        						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
        						if(hisGradeDoc.getYear().intValue()==yearNew3) {
        							
        							
        							int myGrade=hisGradeDoc.getGrade();
        							
        							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
        								if(hisGradeDoc.getUseIn().equals("广西")) {
        									int fencha=myGrade-minGrade2020;
        									if(fencha==0) {
        										minGrade2020Seq=hisGradeDoc.getSeq();
        										break;
        									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
        										minGrade2020Seq=lastSeq;
        										break;
        									}
        									
        									lastSeq=hisGradeDoc.getSeq();
        									
        								}
        							}else {
        								if(hisGradeDoc.getUseIn().equals("全国")) {
        									int fencha=myGrade-minGrade2020;
        									if(fencha==0) {
        										minGrade2020Seq=hisGradeDoc.getSeq();
        										break;
        									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
        										minGrade2020Seq=lastSeq;
        										break;
        									}
        									
        									lastSeq=hisGradeDoc.getSeq();
        								}
        							}
        							
        						}
        					}
        					
        					schoolRecord2020.setAvgGradeSeq(new Integer(avgGrade2020Seq).toString());
        					schoolRecord2020.setMinGradeSeq(new Integer(minGrade2020Seq).toString());
        					
        					
        					
        					
        					
        				}else {
        					schoolRecord2020.setAvgGrade("-");
        					schoolRecord2020.setMinGrade("-");
        					
        					schoolRecord2020.setAvgGradeSeq("-");
        					schoolRecord2020.setMinGradeSeq("-");
        				}
        				if(admission2020!=null) {
	        				plan2020=admission2020.getPlan();
	    					if(admission2020.getSubmit()!=null) {
	    						submit2020=admission2020.getSubmit();
	    					}
	    					adm2020=admission2020.getAdmission();
	    					schoolRecord2020.setPlanSubmitAdmission(plan2020+"-"+adm2020);
        				}
        				
        				//开始计算投档概率
        				/*
        				 *   专业组投档概率计算
        				 * 
        				 * 1.  3年的同位分都比录取平均分高，则(2022年同位分-2022年平均分)*55%+(2021年同位分-2021年平均分)*30%+(2020年同位分-2020年平均分)*15%
        				 * 
        				 *     3年的同位分都比录取平均分高，则((2022年同位分-2022年平均分)/2+85%)*55%+((2021年同位分-2021年平均分)/2+85%)*30%+((2020年同位分-2020年平均分)/2+85%)*15%
        				 *     
        				 *     有2年高于平均分（1年低于平均分），则((2022年高于的同位分-2022年平均分)/2+75%)*55%+((2021年高于的同位分-2021年平均分)/2+75%)*30%+((2020高于年同位分-2020年平均分)/2+75%)*15%
        				 *                                     ((2022年低于的同位分-2022年最低分)/2+55%)*55%+((2021年低于的同位分-2021年最低分)/2+55%)*30%+((2020低于年同位分-2020年最低分)/2+55%)*15%
        				 *                                     
        				 *     有1年高于平均分（2年低于平均分），则((2022年高于的同位分-2022年平均分)/2+65%)*55%+((2021年高于的同位分-2021年平均分)/2+65%)*30%+((2020高于年同位分-2020年平均分)/2+65%)*15%
        				 *                                     ((2022年低于的同位分-2022年最低分)/2+55%)*55%+((2021年低于的同位分-2021年最低分)/2+55%)*30%+((2020低于年同位分-2020年最低分)/2+55%)*15%
        				 *     
        				 * 
        				 * 2.  3年都低于平均分的，则((2022年同位分-2022年录取最低分)/2+50%)*55%+((2021年同位分-2021年录取最低分)/2+50%)*30%+((2020年同位分-2020年录取最低分)/2+50%)*15%
        				 * 
        				 * 3.  如果数据不满3年，只有2年，则剩下的两年各乘50%。只有一年的录取数据的，乘100%。
        				 * 
        				 * 
        				 * 招生数量对比占的概率
        				 * 1.当年招生数量，H是当年的招生数量，I是去年的招生数量
        				 * H＜=20，（H-I）%=h
                           20＜=H＜50,（H-I）×0.5%=h。
                           50＜H＜100,（H-I）×0.3%=h。
                           100＜H,（H-I）×0.1%=h。
                           h最大只能是30%
                          
                          //目前的数据，投档数都是0，所以下面的内容暂时不算了 
                          2. I是去年的招生数量，L是去年的专业投档数 ；J是前年的招生数量，M是前年的专业投档数；K是大前年的招生数量，N是大前年的专业投档数
                          I-L为正数，增加5%概率，以i代替。
                          J-M为正数，增加5%概率，以j代替。
                          K-N为正数，增加5%概率，以k代替。
                          
                          
                          
                          
                          专业投档概率计算
                          如果2023年招生人数<2022年招生人数，则(((2022年同位分-（2023年人数）的名次录取分))/2+50%)*55%   否则如果2023年招生人数>2022年招生人数,则((2022年同位分-（2022录取人数的最后一名的录取分)/2+50%)*55%，
                          如果2023年招生人数<2021年招生人数，则(2021年同位分-（2023年人数）的名次录取分))/2+50%)*30%+  否则如果2023年招生人数>2021年招生人数,则((2021年同位分-（2021录取人数的最后一名的录取分)/2+50%)*30%，
                          如果2023年招生人数<2020年招生人数，则(2020年同位分-（2023年人数）的名次录取分))/2+50%)*15%+  否则如果2023年招生人数>2020年招生人数,则((2020年同位分-（2020录取人数的最后一名的录取分)/2+50%)*15%，                           
                         
                                 
        				 * 
        				 * 3.  如果数据不满3年，只有2年，则剩下的两年各乘60%,40%。只有一年的录取数据的，乘100%。
                          
                          
                         * 招生数量对比占的概率
        				 * 1.当年招生数量，H是当年的招生数量，I是去年的招生数量
        				 * H＜=20，（H-I）%=h
                           20＜=H＜50,（H-I）×0.5%=h。
                           50＜H＜100,（H-I）×0.3%=h。
                           100＜H,（H-I）×0.1%=h。
                           h最大只能是30%
                          
                          
                          
                          
                          
                          
                          
                          
                          
                          
                          
                           
        				 */
        				
        				
        				
        				/****
        				 * 专科的录取概率计算
        				 * 2024年的分数为a，2023年的院校录取最低分为b,a-b除2—再加50%等于院校专业组投档概率。2024年的分数为c，2023年的专业录取最低分为d,c-d除2—再加50%等于院校专业录取概率。
        				 */
        				if(provinceName.equals("广西")) {//广西学校
        					int userGrade=memberQuery.getGxgrade();
        					double rate=(userGrade-minGrade2022)/2+50;
        					if(rate>=100) rate=99.99;
							if(rate<1) rate=1;
							schoolRecord2020.setSubmitRate(df.format(rate));
							schoolRecord2021.setSubmitRate(df.format(rate));
							schoolRecord2022.setSubmitRate(df.format(rate));
        				}else {//全国学校
        					if(qgjfFlag) {//认可加分
        						int userGrade=memberQuery.getQggrade();
            					double rate=(userGrade-minGrade2022)/2+50;
            					if(rate>=100) rate=99.99;
    							if(rate<1) rate=1;
    							schoolRecord2020.setSubmitRate(df.format(rate));
    							schoolRecord2021.setSubmitRate(df.format(rate));
    							schoolRecord2022.setSubmitRate(df.format(rate));
        					}else {
        						int userGrade=memberQuery.getGrade();
            					double rate=(userGrade-minGrade2022)/2+50;
            					if(rate>=100) rate=99.99;
    							if(rate<1) rate=1;
    							schoolRecord2020.setSubmitRate(df.format(rate));
    							schoolRecord2021.setSubmitRate(df.format(rate));
    							schoolRecord2022.setSubmitRate(df.format(rate));
        					}
        					
        				}
        					
        				if(schoolRecord2022.getSubmitRate()==null) {
        					schoolRecord2022.setSubmitRate("-");
        				}
        				if(schoolRecord2022.getPlanSubmitAdmission()==null) {
        					schoolRecord2022.setPlanSubmitAdmission("-");
        				}
        				
        				
        				if(schoolRecord2022.getAvgGradeSeq()==null||schoolRecord2022.getAvgGradeSeq().equals("99999999")) {
        					schoolRecord2022.setAvgGradeSeq("-");
        				}
        				
        				if(schoolRecord2022.getMinGradeSeq()==null||schoolRecord2022.getMinGradeSeq().equals("99999999")) {
        					schoolRecord2022.setMinGradeSeq("-");
        				}
        				
        				
        				if(schoolRecord2021.getSubmitRate()==null) {
        					schoolRecord2021.setSubmitRate("-");
        					
        				}
        				if(schoolRecord2021.getPlanSubmitAdmission()==null) {
        					schoolRecord2021.setPlanSubmitAdmission("-");
        				}
        				
        				
        				if(schoolRecord2021.getAvgGradeSeq()==null||schoolRecord2021.getAvgGradeSeq().equals("99999999")) {
        					schoolRecord2021.setAvgGradeSeq("-");
        				}
        				
        				if(schoolRecord2021.getMinGradeSeq()==null||schoolRecord2021.getMinGradeSeq().equals("99999999")) {
        					schoolRecord2021.setMinGradeSeq("-");
        				}
        				
        				
        				if(schoolRecord2020.getSubmitRate()==null) {
        					schoolRecord2020.setSubmitRate("-");
        				}
        				if(schoolRecord2020.getPlanSubmitAdmission()==null) {
        					schoolRecord2020.setPlanSubmitAdmission("-");
        				}
        				
        				
        				if(schoolRecord2020.getAvgGradeSeq()==null||schoolRecord2020.getAvgGradeSeq().equals("99999999")) {
        					schoolRecord2020.setAvgGradeSeq("-");
        				}
        				
        				if(schoolRecord2020.getMinGradeSeq()==null||schoolRecord2020.getMinGradeSeq().equals("99999999")) {
        					schoolRecord2020.setMinGradeSeq("-");
        				}
        				
        				
        				returnList.add(schoolRecord2022);
        				returnList.add(schoolRecord2021);
        				returnList.add(schoolRecord2020);
        				
        			}//循环专业组，学校相同结束
        			
        			
        			
        		}
        		
        		
        	}
        			
        }
        return AjaxResult.success(getDataTable(returnList));
    }
    
    
    /**
     * 
     * @param province
     * @param schoolTypes
     * @param schoolCode2
     * @param batch
     * @param userId
     * @param pageNum
     * @param schoolCodeInp
     * @param schoolNameInp
     * @param submitType 投档概率  L冲刺院校 概率小于60%，M稳妥院校 概率60%-90%，H保底院校 90%以上
     * @return
     */
    @ApiOperation("按投档概率分析列表")
    @GetMapping("/zhfx_list_h5")
    public AjaxResult zhfx_list_h5(String pageType,String province,String schoolTypes,String schoolCode2,String batch,String userId,Integer pageNum,String schoolCodeInp,String schoolNameInp,String submitType)
    {
    	System.out.println("--------province------"+province+"--------schoolNameInp----"+schoolNameInp);
    	
    	if(userId==null||userId.equals("")) {
    		//userId="1786281642017542144";
    		return AjaxResult.error("请先登录");
    	}
    	
    	if(isSpecialChar(userId.toString())||sqlValidate(userId.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	BuzMember memberQuery=buzMemberService.selectBuzMemberById(userId);

    	if(memberQuery!=null&&memberQuery.getPhone()!=null) {
    		
    	}else {
    		
    		return AjaxResult.error("会员信息不存在，请先注册成为会员");
    	}

		System.out.println("--------userId------"+userId+"---------memberQuery.getSfvip()=---"+memberQuery.getSfvip());
    	
    	if(memberQuery.getSfvip().intValue()==0) {
        	return AjaxResult.error("系统已更新，非会员不能查询");
        }
        
        /****
         * 1、查找满足条件的学校
         * 2、获取每个学校的专业组
         * 3、需要根据考生是文科还是理科，根据公式，计算投档率
         */
        
        School schoolQuery=new School();
        if(province!=null&&!province.equals("")) {
        	
        	if(isSpecialChar(province.toString())||sqlValidate(province.toString())){
        		AjaxResult.error("参数包含非法字符");
        	}
        	
        	schoolQuery.setSprovince(new Long(province));
        }
        
        if(schoolTypes!=null&&!schoolTypes.equals("")) {
        	
        	if(isSpecialChar(schoolTypes.toString())||sqlValidate(schoolTypes.toString())){
        		AjaxResult.error("参数包含非法字符");
        	}
        	
        	schoolQuery.setStypes(schoolTypes);
        }
        
        
        if(schoolCode2!=null&&!schoolCode2.equals("")) {
        	
        	if(isSpecialChar(schoolCode2.toString())||sqlValidate(schoolCode2.toString())){
        		AjaxResult.error("参数包含非法字符");
        	}
        	
        	schoolQuery.setScode(schoolCode2);
        }
        
		if(schoolCodeInp!=null&&!schoolCodeInp.equals("")) {
		        	
		        	if(isSpecialChar(schoolCodeInp.toString())||sqlValidate(schoolCodeInp.toString())){
		        		AjaxResult.error("参数包含非法字符");
		        	}
		        	
		        	schoolQuery.setScode(schoolCodeInp);
		        }
		
		if(schoolNameInp!=null&&!schoolNameInp.equals("")) {
			
			if(isSpecialChar(schoolNameInp.toString())||sqlValidate(schoolNameInp.toString())){
				AjaxResult.error("参数包含非法字符");
			}
			
			schoolQuery.setSname(schoolNameInp);
		}
        
        
        if("物理".equals(memberQuery.getSxkm())) {
        	schoolQuery.setMajorType("理工类");
    	}
    	if("历史".equals(memberQuery.getSxkm())) {
    		schoolQuery.setMajorType("文史类");
    	}
    	
    	
    	//如果会员不是少数民族，则不能查询民族班
    	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
    		schoolQuery.setSsmzFlag(0);
    	}
    	
    	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
    		schoolQuery.setGjzxFlag(0);
    	}
    	
    	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
    		schoolQuery.setGxzxFlag(0);
    	}

		if(pageType!=null&&!pageType.equals("")) {

			if(isSpecialChar(pageType.toString())||sqlValidate(pageType.toString())){
				AjaxResult.error("参数包含非法字符");
			}
			if(pageType.equals("c")) {
				schoolQuery.setSubmitPageType(1);
			}
			if(pageType.equals("z")) {
				schoolQuery.setSubmitPageType(2);
			}
			if(pageType.equals("w")) {
				schoolQuery.setSubmitPageType(3);
			}
			if(pageType.equals("s")) {
				schoolQuery.setSubmitPageType(4);
			}
			if(pageType.equals("b")) {
				schoolQuery.setSubmitPageType(5);
			}
		}
    	
    	
    	//考生的再选科目
    	schoolQuery.setZxkm(memberQuery.getZxkm());    	
        
        String schoolCode="";
        
        if(pageNum==null||pageNum.intValue()==0) pageNum=1;
        int pageRow=(pageNum-1)*10;
        
        schoolQuery.setPageNum(pageRow);
		System.out.println("--------befor query school------");
        List<School> list = schoolService.selectSchoolList4H5Page(schoolQuery);
        if(list!=null&&list.size()>0) {
        	for(int i=0;i<list.size();i++) {
        		School school=list.get(i);
        		schoolCode=schoolCode+"'"+school.getScode()+"',";
        	}
        }
        
        
        
        List<SysDictData> data = dictTypeService.selectDictDataByType("school_level");
        
        
        
        
        List<School> returnList =new ArrayList();
        
        if(!schoolCode.equals("")) {
        	schoolCode=schoolCode.substring(0, schoolCode.length()-1);
        	//查询专业组
        	SchoolPlan schoolPlanQuery=new SchoolPlan();
        	schoolPlanQuery.setYear(thisYear);
        	schoolPlanQuery.setSchoolCode(schoolCode);
        	if("物理".equals(memberQuery.getSxkm())) {
        		schoolPlanQuery.setMajorType("理工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		schoolPlanQuery.setMajorType("文史类");
        	}
        	
        	//如果会员不是少数民族，则不能查询民族班
        	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
        		schoolPlanQuery.setSsmzFlag(0);
        	}
        	
        	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
        		schoolPlanQuery.setGjzxFlag(0);
        	}
        	
        	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
        		schoolPlanQuery.setGxzxFlag(0);
        	}
        	
        	//考生的再选科目
        	schoolPlanQuery.setZxkm(memberQuery.getZxkm());
        	
        	
        	List<SchoolPlan> zyzList =schoolPlanService.selectSchoolZyzPlanList(schoolPlanQuery);
        	
        	//List<SchoolPlan> zyzList =schoolPlanService.selectSchoolZyzList(schoolPlanQuery);
        	
        	List<SchoolPlan> plans2023List =schoolPlanService.selectSchoolZyz2023PlanList(schoolPlanQuery);

			List<SchoolPlan> plans2024List =schoolPlanService.selectSchoolZyz2024PlanList(schoolPlanQuery);
        	
        	//查询各个专业组近3年的平均分、最低分（当前计算，先以2020,2021,2022这3年的录取数据为模拟数据）
        	SchoolMajorYearAdmission schoolMajorYearAdmission=new SchoolMajorYearAdmission();
        	schoolMajorYearAdmission.setYear(thisYear);
        	schoolMajorYearAdmission.setsCode(schoolCode);
        	if("物理".equals(memberQuery.getSxkm())) {
        		schoolMajorYearAdmission.setMajorType("理工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		schoolMajorYearAdmission.setMajorType("文史类");
        	}
        	
        	//如果会员不是少数民族，则不能查询民族班
        	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
        		schoolMajorYearAdmission.setSsmzFlag(0);
        	}
        	
        	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
        		schoolMajorYearAdmission.setGjzxFlag(0);
        	}
        	
        	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
        		schoolMajorYearAdmission.setGxzxFlag(0);
        	}
        	
        	//考生的再选科目
        	schoolMajorYearAdmission.setZxkm(memberQuery.getZxkm());
        	
        	List<SchoolMajorYearAdmission> zyzGradeList=schoolMajorYearAdmissionService.selectSchoolZyzYearAdmissionList(schoolMajorYearAdmission);
        	
        	
        	
        	
        	
        	
        	
        	//查询历年一分一档，用于计算平均分排位和最低分排位
        	GkGradeDoc hisGkGradeDoc=new GkGradeDoc();
        	if("物理".equals(memberQuery.getSxkm())) {
        		hisGkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		hisGkGradeDoc.setGradeClass("史类");
        	}
        	
        	List<GkGradeDoc> hisPwGradeList=gkGradeDocService.selectGkGradeDocList(hisGkGradeDoc);
        	
        	
        	
        	
        	
        	
        	
        	//查询当年考生的排位(先用2023年的一分一档)，拿到2023年该分数的排位，取出2022、2021、2020年的同位分
        	int gxpw=99999999;
        	
        	//广西排位分
        	GkGradeDoc gkGradeDoc=new GkGradeDoc();
        	gkGradeDoc.setGrade(memberQuery.getGxgrade());
        	gkGradeDoc.setYear(gradeLineYear);
        	if("物理".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("史类");
        	}
        	List<GkGradeDoc> gradeList=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);
        	
        	for(int z=0;z<gradeList.size();z++) {
        		GkGradeDoc gradeDoc=gradeList.get(z);
        		if(gradeDoc.getUseIn().equals("广西")) {
        			gxpw=gradeDoc.getSeq();
        		}
        	}
        	
        	//查找近3年的广西同位分
        	gkGradeDoc=new GkGradeDoc();
        	if("物理".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("史类");
        	}
        	gkGradeDoc.setUseIn("广西");
        	gkGradeDoc.setSeq(gxpw);
        	List<GkGradeDoc> gxpwGradeList=gkGradeDocService.selectGkGradeDocListBySeq(gkGradeDoc);
        	
        	
        	
        	
        	
        	
        	
        	int qgpw=99999999;
        	
        	
        	int temp_qgjfpw=99999999;//全国加分的排位(认可加分)
        	int temp_qgpw=99999999;//全国加分的排位(不认可加分)
        	
        	
        	//全国认可加分排位分
        	gkGradeDoc=new GkGradeDoc();
        	gkGradeDoc.setGrade(memberQuery.getQggrade());
        	
        	gkGradeDoc.setYear(2024);
        	if("物理".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("史类");
        	}
        	List<GkGradeDoc> gradeList2=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);
        	
        	for(int z=0;z<gradeList2.size();z++) {
        		GkGradeDoc gradeDoc=gradeList2.get(z);
        		
        		if(gradeDoc.getUseIn().equals("全国")) {
        			temp_qgjfpw=gradeDoc.getSeq();//认可加分的排位分
        		}
        	}
        	
        	//全国不认可加分排位分
        	gkGradeDoc=new GkGradeDoc();
        	gkGradeDoc.setGrade(memberQuery.getGrade());
        	
        	gkGradeDoc.setYear(2024);
        	if("物理".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("史类");
        	}
        	List<GkGradeDoc> gradeList3=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);
        	
        	for(int z=0;z<gradeList3.size();z++) {
        		GkGradeDoc gradeDoc=gradeList3.get(z);
        		
        		if(gradeDoc.getUseIn().equals("全国")) {
        			temp_qgpw=gradeDoc.getSeq();//认可加分的排位分
        		}
        	}
        	
        	
        	
        	
        	//查找进3年的全国同位分（认可加分的排位）
        	gkGradeDoc=new GkGradeDoc();
        	if("物理".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("史类");
        	}
        	gkGradeDoc.setUseIn("全国");
        	gkGradeDoc.setSeq(temp_qgjfpw);
        	List<GkGradeDoc> qgpwGradeList=gkGradeDocService.selectGkGradeDocListBySeq(gkGradeDoc);
        	
        	
        	//不认可加分的排位
        	gkGradeDoc.setSeq(temp_qgpw);
        	List<GkGradeDoc> qgpwNoAddGradeList=gkGradeDocService.selectGkGradeDocListBySeq(gkGradeDoc);
        	
        	
        	
        	DecimalFormat df = new DecimalFormat("#.00");
        	//开始计算专业组投档率
        	for(int i=0;i<list.size();i++) {
        		School school=list.get(i);//一共有N个学校
        		String provinceName=school.getProvinceName();
        		
        		boolean qgjfFlag=true;//是否认可全国加分
            	if(school.getRemark()!=null) {
            		if(school.getRemark().indexOf("不认可加分")>-1) {//该学校不认可加分，则全国分只取高考分
            			qgjfFlag=false;
            		}
            	}
        		

            	//查找近3年的广西排位
            	int gxj2022=0;
            	int gxj2021=0;
            	int gxj2020=0;
            	for(int z=0;z<gxpwGradeList.size();z++) {
            		GkGradeDoc gxGradeDoc=gxpwGradeList.get(z);
            		if(gxGradeDoc.getYear().intValue()==yearNew1) {
            			gxj2022=gxGradeDoc.getGrade();
            		}
            		if(gxGradeDoc.getYear().intValue()==yearNew2) {
            			gxj2021=gxGradeDoc.getGrade();
            		}
            		if(gxGradeDoc.getYear().intValue()==yearNew3) {
            			gxj2020=gxGradeDoc.getGrade();
            		}
            	}
            	
            	
            	
            	
            	int qgj2022=0;//近3年全国不加分的排位分
            	int qgj2021=0;
            	int qgj2020=0;
            	if(qgjfFlag) {//认可加分
            		qgpw=temp_qgjfpw;
            		for(int z=0;z<qgpwGradeList.size();z++) {
                		GkGradeDoc gxGradeDoc=qgpwGradeList.get(z);
                		if(gxGradeDoc.getYear().intValue()==yearNew1) {
                			qgj2022=gxGradeDoc.getGrade();
                		}
                		if(gxGradeDoc.getYear().intValue()==yearNew2) {
                			qgj2021=gxGradeDoc.getGrade();
                		}
                		if(gxGradeDoc.getYear().intValue()==yearNew3) {
                			qgj2020=gxGradeDoc.getGrade();
                		}
                	}
            	}else {//不认可加分
            		qgpw=temp_qgpw;
            		for(int z=0;z<qgpwNoAddGradeList.size();z++) {
                		GkGradeDoc gxGradeDoc=qgpwNoAddGradeList.get(z);
                		if(gxGradeDoc.getYear().intValue()==yearNew1) {
                			qgj2022=gxGradeDoc.getGrade();
                		}
                		if(gxGradeDoc.getYear().intValue()==yearNew2) {
                			qgj2021=gxGradeDoc.getGrade();
                		}
                		if(gxGradeDoc.getYear().intValue()==yearNew3) {
                			qgj2020=gxGradeDoc.getGrade();
                		}
                	}
            	}
            	
        		
        		
        		for(int k=0;k<zyzList.size();k++) {
        			SchoolPlan zyzPlan=zyzList.get(k);//取出该学校的专业组
        			if(zyzPlan.getSchoolCode().equals(school.getScode())){
        				String zyz=zyzPlan.getZyz();
        				
        				
        				int avgGrade2022=0;
        				int minGrade2022=0;
        				int avgGrade2021=0;
        				int minGrade2021=0;
        				int avgGrade2020=0;
        				int minGrade2020=0;
        				
        				//历史招生数量，从指南取
        				int plan2022=0;
        				int submit2022=0;
        				int adm2022=0;
        				int plan2021=0;
        				int submit2021=0;
        				int adm2021=0;
        				int plan2020=0;
        				int submit2020=0;
        				int adm2020=0;
        				
        				//当年招生数量，从招生计划取
        				int plan2023=0;
        				
        				School schoolRecord2022=new School();
        				schoolRecord2022.setProvinceName(provinceName);
        				schoolRecord2022.setSname(school.getSname());
        				schoolRecord2022.setZyz(zyz);
        				schoolRecord2022.setScode(school.getScode());
        				schoolRecord2022.setZxkm(zyzPlan.getKm2());
        				schoolRecord2022.setYear(yearNew1);
        				schoolRecord2022.setSranking(school.getSranking());
        				
        				String collegeLevel= school.getCollegeLevel();
        				if(collegeLevel!=null&&!collegeLevel.equals("")) {
        					String collegeLevelStr="";
        					String[] collegeLevelArr=collegeLevel.split(",");
        					for(int m=0;m<data.size();m++) {
        						SysDictData dicData=data.get(m);
        						for(int n=0;n<collegeLevelArr.length;n++) {
        							if(dicData.getDictCode().equals(collegeLevelArr[n])) {
        								collegeLevelStr=collegeLevelStr+dicData.getDictLabel()+",";
        							}
        						}
        					}
        					if(!collegeLevelStr.equals("")) {
        						collegeLevelStr=collegeLevelStr.substring(0, collegeLevelStr.length()-1);
        						schoolRecord2022.setCollegeLevel(collegeLevelStr);
        					}
        				}
        				
        				
        				
        				if(provinceName.equals("广西")) {
        					schoolRecord2022.setSeqGrade(new Integer(gxj2022).toString());
        					schoolRecord2022.setSeq(new Integer(gxpw).toString());
        				}else {
        					schoolRecord2022.setSeqGrade(new Integer(qgj2022).toString());
        					schoolRecord2022.setSeq(new Integer(qgpw).toString());
        				}
        				
        				
        				//设置分数线
        				if("物理".equals(memberQuery.getSxkm())) {
        					schoolRecord2022.setGradeLine(new Integer(gradeLineLg2022).toString());
        				}
        				if("历史".equals(memberQuery.getSxkm())) {
        					schoolRecord2022.setGradeLine(new Integer(gradeLineWs2022).toString());
        				}
        				
        				SchoolMajorYearAdmission admission2022=null;
        				SchoolMajorYearAdmission admission2021=null;
        				SchoolMajorYearAdmission admission2020=null;
        				for(int j=0;j<zyzGradeList.size();j++) {
        					SchoolMajorYearAdmission admission=zyzGradeList.get(j);
        					String zyzAdmin=admission.getZyz();
        					
        					if(zyz.equals(zyzAdmin)&&admission.getsCode().equals(zyzPlan.getSchoolCode())) {//同一个学校的专业组        						
        						if(admission.getYear()==yearNew1) {
        							admission2022=admission;
        						}
        						if(admission.getYear()==yearNew2) {
        							admission2021=admission;
        						}
        						if(admission.getYear()==yearNew3) {
        							admission2020=admission;
        						}
        					}
        				}
        				if(admission2022!=null&&admission2022.getAvgGrade()!=null) {
        					schoolRecord2022.setAvgGrade(admission2022.getAvgGrade().toString());
        					schoolRecord2022.setMinGrade(admission2022.getLowGrade().toString());
        					avgGrade2022=admission2022.getAvgGrade();
        					minGrade2022=admission2022.getLowGrade();
        					
        					//计算平均分排位，最低分排位
        					int avgGrade2022Seq=99999999;
        					int lastSeq=1;
        					for(int m=0;m<hisPwGradeList.size();m++) {
        						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
        						if(hisGradeDoc.getYear().intValue()==yearNew1) {
        							
        							
        							int myGrade=hisGradeDoc.getGrade();
        							
        							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
        								if(hisGradeDoc.getUseIn().equals("广西")) {
        									int fencha=myGrade-avgGrade2022;
        									if(fencha==0) {
        										avgGrade2022Seq=hisGradeDoc.getSeq();
        										break;
        									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
        										avgGrade2022Seq=lastSeq;
        										break;
        									}
        									
        									lastSeq=hisGradeDoc.getSeq();
        									
        								}
        							}else {
        								if(hisGradeDoc.getUseIn().equals("全国")) {
        									int fencha=myGrade-avgGrade2022;
        									if(fencha==0) {
        										avgGrade2022Seq=hisGradeDoc.getSeq();
        										break;
        									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
        										avgGrade2022Seq=lastSeq;
        										break;
        									}
        									
        									lastSeq=hisGradeDoc.getSeq();
        								}
        							}
        							
        						}
        					}
        					
        					schoolRecord2022.setAvgGradeSeq(new Integer(avgGrade2022Seq).toString());
        					
        					
        					int minGrade2022Seq=99999999;
        					lastSeq=1;
        					for(int m=0;m<hisPwGradeList.size();m++) {
        						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
        						if(hisGradeDoc.getYear().intValue()==yearNew1) {
        							
        							
        							int myGrade=hisGradeDoc.getGrade();
        							
        							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
        								if(hisGradeDoc.getUseIn().equals("广西")) {
        									int fencha=myGrade-minGrade2022;
        									if(fencha==0) {
        										minGrade2022Seq=hisGradeDoc.getSeq();
        										break;
        									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
        										minGrade2022Seq=lastSeq;
        										break;
        									}
        									
        									lastSeq=hisGradeDoc.getSeq();
        									
        								}
        							}else {
        								if(hisGradeDoc.getUseIn().equals("全国")) {
        									int fencha=myGrade-minGrade2022;
        									if(fencha==0) {
        										minGrade2022Seq=hisGradeDoc.getSeq();
        										break;
        									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
        										minGrade2022Seq=lastSeq;
        										break;
        									}
        									
        									lastSeq=hisGradeDoc.getSeq();
        								}
        							}
        							
        						}
        					}
        					
        					schoolRecord2022.setAvgGradeSeq(new Integer(avgGrade2022Seq).toString());
        					schoolRecord2022.setMinGradeSeq(new Integer(minGrade2022Seq).toString());
        					
        					
        					
        					
        					
        				}else {
        					schoolRecord2022.setAvgGrade("-");
        					schoolRecord2022.setMinGrade("-");
        					schoolRecord2022.setAvgGradeSeq("-");
        					schoolRecord2022.setMinGradeSeq("-");
        				}
        				if(admission2022!=null) {
	        				plan2022=admission2022.getPlan();
	    					if(admission2022.getSubmit()!=null) {
	    						submit2022=admission2022.getSubmit();
	    					}
	    					adm2022=admission2022.getAdmission();
	    					schoolRecord2022.setPlanSubmitAdmission(plan2022+"-"+adm2022);
        				}
        				
        				
        				for(int j=0;j<plans2023List.size();j++) {
        					SchoolPlan schoolPlan2023=plans2023List.get(j);
        					if(zyz.equals(schoolPlan2023.getZyz())&&zyzPlan.getSchoolCode().equals(schoolPlan2023.getSchoolCode())) {//同一个学校的专业组        	
        						plan2023=schoolPlan2023.getMajorPlan();
        					}
        				}
        				
        				
        				School schoolRecord2021=new School();
        				schoolRecord2021.setProvinceName(provinceName);
        				schoolRecord2021.setSname(school.getSname());
        				schoolRecord2021.setScode(school.getScode());
        				schoolRecord2021.setZyz(zyz);
        				schoolRecord2021.setZxkm(zyzPlan.getKm2());
        				schoolRecord2021.setYear(yearNew2);
        				schoolRecord2021.setSranking(school.getSranking());
        				schoolRecord2021.setCollegeLevel(schoolRecord2022.getCollegeLevel());
        				
        				if(provinceName.equals("广西")) {
        					schoolRecord2021.setSeqGrade(new Integer(gxj2021).toString());
        					schoolRecord2021.setSeq(new Integer(gxpw).toString());
        				}else {
        					schoolRecord2021.setSeqGrade(new Integer(qgj2021).toString());
        					schoolRecord2021.setSeq(new Integer(qgpw).toString());
        				}
        				
        				
        				//设置分数线
        				if("物理".equals(memberQuery.getSxkm())) {
        					schoolRecord2021.setGradeLine(new Integer(gradeLineLg2021).toString());
        				}
        				if("历史".equals(memberQuery.getSxkm())) {
        					schoolRecord2021.setGradeLine(new Integer(gradeLineWs2021).toString());
        				}
        				
        				if(admission2021!=null&&admission2021.getAvgGrade()!=null) {
        					schoolRecord2021.setAvgGrade(admission2021.getAvgGrade().toString());
        					schoolRecord2021.setMinGrade(admission2021.getLowGrade().toString());
        					avgGrade2021=admission2021.getAvgGrade();
        					minGrade2021=admission2021.getLowGrade();
        					
        					
        					
        					
        					
        					//计算平均分排位，最低分排位
        					int avgGrade2021Seq=99999999;
        					int lastSeq=1;
        					for(int m=0;m<hisPwGradeList.size();m++) {
        						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
        						if(hisGradeDoc.getYear().intValue()==yearNew2) {
        							
        							
        							int myGrade=hisGradeDoc.getGrade();
        							
        							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
        								if(hisGradeDoc.getUseIn().equals("广西")) {
        									int fencha=myGrade-avgGrade2021;
        									if(fencha==0) {
        										avgGrade2021Seq=hisGradeDoc.getSeq();
        										break;
        									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
        										avgGrade2021Seq=lastSeq;
        										break;
        									}
        									
        									lastSeq=hisGradeDoc.getSeq();
        									
        								}
        							}else {
        								if(hisGradeDoc.getUseIn().equals("全国")) {
        									int fencha=myGrade-avgGrade2021;
        									if(fencha==0) {
        										avgGrade2021Seq=hisGradeDoc.getSeq();
        										break;
        									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
        										avgGrade2021Seq=lastSeq;
        										break;
        									}
        									
        									lastSeq=hisGradeDoc.getSeq();
        								}
        							}
        							
        						}
        					}
        					
        					schoolRecord2021.setAvgGradeSeq(new Integer(avgGrade2021Seq).toString());
        					
        					
        					int minGrade2021Seq=99999999;
        					lastSeq=1;
        					for(int m=0;m<hisPwGradeList.size();m++) {
        						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
        						if(hisGradeDoc.getYear().intValue()==yearNew2) {
        							
        							
        							int myGrade=hisGradeDoc.getGrade();
        							
        							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
        								if(hisGradeDoc.getUseIn().equals("广西")) {
        									int fencha=myGrade-minGrade2021;
        									if(fencha==0) {
        										minGrade2021Seq=hisGradeDoc.getSeq();
        										break;
        									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
        										minGrade2021Seq=lastSeq;
        										break;
        									}
        									
        									lastSeq=hisGradeDoc.getSeq();
        									
        								}
        							}else {
        								if(hisGradeDoc.getUseIn().equals("全国")) {
        									int fencha=myGrade-minGrade2021;
        									if(fencha==0) {
        										minGrade2021Seq=hisGradeDoc.getSeq();
        										break;
        									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
        										minGrade2021Seq=lastSeq;
        										break;
        									}
        									
        									lastSeq=hisGradeDoc.getSeq();
        								}
        							}
        							
        						}
        					}
        					
        					schoolRecord2021.setAvgGradeSeq(new Integer(avgGrade2021Seq).toString());
        					schoolRecord2021.setMinGradeSeq(new Integer(minGrade2021Seq).toString());
        					
        					
        					
        					
        					
        				}else {
        					schoolRecord2021.setAvgGrade("-");
        					schoolRecord2021.setMinGrade("-");
        					schoolRecord2021.setAvgGradeSeq("-");
        					schoolRecord2021.setMinGradeSeq("-");
        				}
        				if(admission2021!=null) {
	        				plan2021=admission2021.getPlan();
	    					if(admission2021.getSubmit()!=null) {
	    						submit2021=admission2021.getSubmit();
	    					}
	    					adm2021=admission2021.getAdmission();
	    					schoolRecord2021.setPlanSubmitAdmission(plan2021+"-"+adm2021);
        				}
        				
        				
        				School schoolRecord2020=new School();
        				schoolRecord2020.setProvinceName(provinceName);
        				schoolRecord2020.setSname(school.getSname());
        				schoolRecord2020.setScode(school.getScode());
        				schoolRecord2020.setZyz(zyz);
        				schoolRecord2020.setZxkm(zyzPlan.getKm2());
        				schoolRecord2020.setYear(yearNew3);
        				schoolRecord2020.setSranking(school.getSranking());
        				schoolRecord2020.setCollegeLevel(schoolRecord2022.getCollegeLevel());
        				
        				if(provinceName.equals("广西")) {
        					schoolRecord2020.setSeqGrade(new Integer(gxj2020).toString());
        					schoolRecord2020.setSeq(new Integer(gxpw).toString());
        				}else {
        					schoolRecord2020.setSeqGrade(new Integer(qgj2020).toString());
        					schoolRecord2020.setSeq(new Integer(qgpw).toString());
        				}
        				
        				
        				//设置分数线
        				if("物理".equals(memberQuery.getSxkm())) {
        					schoolRecord2020.setGradeLine(new Integer(gradeLineLg2020).toString());
        				}
        				if("历史".equals(memberQuery.getSxkm())) {
        					schoolRecord2020.setGradeLine(new Integer(gradeLineWs2020).toString());
        				}
        				
        				if(admission2020!=null&&admission2020.getAvgGrade()!=null) {
        					schoolRecord2020.setAvgGrade(admission2020.getAvgGrade().toString());
        					schoolRecord2020.setMinGrade(admission2020.getLowGrade().toString());
        					avgGrade2020=admission2020.getAvgGrade();
        					minGrade2020=admission2020.getLowGrade();        
        					
        					
        					
        					//计算平均分排位，最低分排位
        					int avgGrade2020Seq=99999999;
        					int lastSeq=1;
        					for(int m=0;m<hisPwGradeList.size();m++) {
        						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
        						if(hisGradeDoc.getYear().intValue()==yearNew3) {
        							
        							
        							int myGrade=hisGradeDoc.getGrade();
        							
        							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
        								if(hisGradeDoc.getUseIn().equals("广西")) {
        									int fencha=myGrade-avgGrade2020;
        									if(fencha==0) {
        										avgGrade2020Seq=hisGradeDoc.getSeq();
        										break;
        									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
        										avgGrade2020Seq=lastSeq;
        										break;
        									}
        									
        									lastSeq=hisGradeDoc.getSeq();
        									
        								}
        							}else {
        								if(hisGradeDoc.getUseIn().equals("全国")) {
        									int fencha=myGrade-avgGrade2020;
        									if(fencha==0) {
        										avgGrade2020Seq=hisGradeDoc.getSeq();
        										break;
        									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
        										avgGrade2020Seq=lastSeq;
        										break;
        									}
        									
        									lastSeq=hisGradeDoc.getSeq();
        								}
        							}
        							
        						}
        					}
        					
        					schoolRecord2020.setAvgGradeSeq(new Integer(avgGrade2020Seq).toString());
        					
        					
        					int minGrade2020Seq=99999999;
        					lastSeq=1;
        					for(int m=0;m<hisPwGradeList.size();m++) {
        						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
        						if(hisGradeDoc.getYear().intValue()==yearNew3) {
        							
        							
        							int myGrade=hisGradeDoc.getGrade();
        							
        							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
        								if(hisGradeDoc.getUseIn().equals("广西")) {
        									int fencha=myGrade-minGrade2020;
        									if(fencha==0) {
        										minGrade2020Seq=hisGradeDoc.getSeq();
        										break;
        									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
        										minGrade2020Seq=lastSeq;
        										break;
        									}
        									
        									lastSeq=hisGradeDoc.getSeq();
        									
        								}
        							}else {
        								if(hisGradeDoc.getUseIn().equals("全国")) {
        									int fencha=myGrade-minGrade2020;
        									if(fencha==0) {
        										minGrade2020Seq=hisGradeDoc.getSeq();
        										break;
        									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
        										minGrade2020Seq=lastSeq;
        										break;
        									}
        									
        									lastSeq=hisGradeDoc.getSeq();
        								}
        							}
        							
        						}
        					}
        					
        					schoolRecord2020.setAvgGradeSeq(new Integer(avgGrade2020Seq).toString());
        					schoolRecord2020.setMinGradeSeq(new Integer(minGrade2020Seq).toString());
        					
        					
        					
        					
        					
        				}else {
        					schoolRecord2020.setAvgGrade("-");
        					schoolRecord2020.setMinGrade("-");
        					
        					schoolRecord2020.setAvgGradeSeq("-");
        					schoolRecord2020.setMinGradeSeq("-");
        				}
        				if(admission2020!=null) {
	        				plan2020=admission2020.getPlan();
	    					if(admission2020.getSubmit()!=null) {
	    						submit2020=admission2020.getSubmit();
	    					}
	    					adm2020=admission2020.getAdmission();
	    					schoolRecord2020.setPlanSubmitAdmission(plan2020+"-"+adm2020);
        				}
        				
        				//开始计算投档概率
        				/*
        				 *   专业组投档概率计算
        				 * 
        				 * 1.  3年的同位分都比录取平均分高，则(2022年同位分-2022年平均分)*55%+(2021年同位分-2021年平均分)*30%+(2020年同位分-2020年平均分)*15%
        				 * 
        				 *     3年的同位分都比录取平均分高，则((2022年同位分-2022年平均分)/2+85%)*55%+((2021年同位分-2021年平均分)/2+85%)*30%+((2020年同位分-2020年平均分)/2+85%)*15%
        				 *     
        				 *     有2年高于平均分（1年低于平均分），则((2022年高于的同位分-2022年平均分)/2+75%)*55%+((2021年高于的同位分-2021年平均分)/2+75%)*30%+((2020高于年同位分-2020年平均分)/2+75%)*15%
        				 *                                     ((2022年低于的同位分-2022年最低分)/2+55%)*55%+((2021年低于的同位分-2021年最低分)/2+55%)*30%+((2020低于年同位分-2020年最低分)/2+55%)*15%
        				 *                                     
        				 *     有1年高于平均分（2年低于平均分），则((2022年高于的同位分-2022年平均分)/2+65%)*55%+((2021年高于的同位分-2021年平均分)/2+65%)*30%+((2020高于年同位分-2020年平均分)/2+65%)*15%
        				 *                                     ((2022年低于的同位分-2022年最低分)/2+55%)*55%+((2021年低于的同位分-2021年最低分)/2+55%)*30%+((2020低于年同位分-2020年最低分)/2+55%)*15%
        				 *     
        				 * 
        				 * 2.  3年都低于平均分的，则((2022年同位分-2022年录取最低分)/2+50%)*55%+((2021年同位分-2021年录取最低分)/2+50%)*30%+((2020年同位分-2020年录取最低分)/2+50%)*15%
        				 * 
        				 * 3.  如果数据不满3年，只有2年，则剩下的两年各乘50%。只有一年的录取数据的，乘100%。
        				 * 
        				 * 
        				 * 招生数量对比占的概率
        				 * 1.当年招生数量，H是当年的招生数量，I是去年的招生数量
        				 * H＜=20，（H-I）%=h
                           20＜=H＜50,（H-I）×0.5%=h。
                           50＜H＜100,（H-I）×0.3%=h。
                           100＜H,（H-I）×0.1%=h。
                           h最大只能是30%
                          
                          //目前的数据，投档数都是0，所以下面的内容暂时不算了 
                          2. I是去年的招生数量，L是去年的专业投档数 ；J是前年的招生数量，M是前年的专业投档数；K是大前年的招生数量，N是大前年的专业投档数
                          I-L为正数，增加5%概率，以i代替。
                          J-M为正数，增加5%概率，以j代替。
                          K-N为正数，增加5%概率，以k代替。
                          
                          
                          
                          
                          专业投档概率计算
                          如果2023年招生人数<2022年招生人数，则(((2022年同位分-（2023年人数）的名次录取分))/2+50%)*55%   否则如果2023年招生人数>2022年招生人数,则((2022年同位分-（2022录取人数的最后一名的录取分)/2+50%)*55%，
                          如果2023年招生人数<2021年招生人数，则(2021年同位分-（2023年人数）的名次录取分))/2+50%)*30%+  否则如果2023年招生人数>2021年招生人数,则((2021年同位分-（2021录取人数的最后一名的录取分)/2+50%)*30%，
                          如果2023年招生人数<2020年招生人数，则(2020年同位分-（2023年人数）的名次录取分))/2+50%)*15%+  否则如果2023年招生人数>2020年招生人数,则((2020年同位分-（2020录取人数的最后一名的录取分)/2+50%)*15%，                           
                         
                                 
        				 * 
        				 * 3.  如果数据不满3年，只有2年，则剩下的两年各乘60%,40%。只有一年的录取数据的，乘100%。
                          
                          
                         * 招生数量对比占的概率
        				 * 1.当年招生数量，H是当年的招生数量，I是去年的招生数量
        				 * H＜=20，（H-I）%=h
                           20＜=H＜50,（H-I）×0.5%=h。
                           50＜H＜100,（H-I）×0.3%=h。
                           100＜H,（H-I）×0.1%=h。
                           h最大只能是30%
                          
                          
                          
                          
                          
                          
                          
                          
                          
                          
                          
                           
        				 */
        				
        				if(avgGrade2020>0&&avgGrade2021>0&&avgGrade2022>0) {//3年都有数据
        					if(provinceName.equals("广西")) {//广西学校，用广西同位分
        						if(gxj2020-avgGrade2020>0 &&gxj2021-avgGrade2021>0 &&gxj2022-avgGrade2022>0) {//3年的同位分都比录取平均分高
        							double rate=((gxj2022-avgGrade2022)/2+80)*0.55+((gxj2021-avgGrade2021)/2+80)*0.3+((gxj2020-avgGrade2020)/2+80)*0.15;
        							
        							/*
        							 * * 招生数量对比占的概率
			        				 * 1.当年招生数量，H是当年的招生数量，I是去年的招生数量
			        				 * H＜20，（H-I）%=h
			                           20＜=H＜50,（H-I）×0.5%=h。
			                           50＜=H＜100,（H-I）×0.3%=h。
			                           100＜=H,（H-I）×0.1%=h。
			        							 */
        							/*
        							if(plan2023<10) {
        								double rate2=plan2023-plan2022;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}else if(plan2023>=10&&plan2023<50) {
        								double rate2=(plan2023-plan2022)*0.5;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}else if(plan2023>=50&&plan2023<100) {
        								double rate2=(plan2023-plan2022)*0.3;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}else if(plan2023>=100) {
        								double rate2=(plan2023-plan2022)*0.1;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}
        							*/
        							if(rate>=100) rate=99.99;
        							if(rate<1) rate=1;
        							schoolRecord2020.setSubmitRate(df.format(rate));
        							schoolRecord2021.setSubmitRate(df.format(rate));
        							schoolRecord2022.setSubmitRate(df.format(rate));
        						}else {//不是3个
        							double rate=0;
        							//2年高于
        							int count=0;
        							if(gxj2022-avgGrade2022>0) {
        								count++;
        							}
        							if(gxj2021-avgGrade2021>0) {
        								count++;
        							}
        							if(gxj2020-avgGrade2020>0) {
        								count++;
        							}
        							if(count==2) {//有2年高于同位分的
        								
        								if(gxj2022-avgGrade2022>0) {
        									rate=rate+((gxj2022-avgGrade2022)/2+70)*0.55;
        								}else {
        									rate=rate+((gxj2022-minGrade2022)/2+50)*0.55;
        								}
        								
        								if(gxj2021-avgGrade2021>0) {
        									rate=rate+((gxj2021-avgGrade2021)/2+70)*0.3;
        								}else {
        									rate=rate+((gxj2021-minGrade2021)/2+50)*0.3;
        								}
        								
        								if(gxj2020-avgGrade2020>0) {
        									rate=rate+((gxj2020-avgGrade2020)/2+70)*0.15;
        								}else {
        									rate=rate+((gxj2020-minGrade2020)/2+50)*0.15;
        								}
        							}else if(count==1) {//有1年高于同位分的
        								
        								if(gxj2022-avgGrade2022>0) {
        									rate=rate+((gxj2022-avgGrade2022)/2+60)*0.55;
        								}else {
        									rate=rate+((gxj2022-minGrade2022)/2+50)*0.55;
        								}
        								
        								if(gxj2021-avgGrade2021>0) {
        									rate=rate+((gxj2021-avgGrade2021)/2+60)*0.3;
        								}else {
        									rate=rate+((gxj2021-minGrade2021)/2+50)*0.3;
        								}
        								
        								if(gxj2020-avgGrade2020>0) {
        									rate=rate+((gxj2020-avgGrade2020)/2+60)*0.15;
        								}else {
        									rate=rate+((gxj2020-minGrade2020)/2+50)*0.15;
        								}
        								
        							}else {//一个高于的都没有
        								rate=((gxj2022-minGrade2022)/2+50)*0.55+((gxj2021-minGrade2021)/2+50)*0.3+((gxj2020-minGrade2020)/2+50)*0.15;
        							}
   
        							
        							/*
        							if(plan2023<10) {
        								double rate2=plan2023-plan2022;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}else if(plan2023>=10&&plan2023<50) {
        								double rate2=(plan2023-plan2022)*0.5;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}else if(plan2023>=50&&plan2023<100) {
        								double rate2=(plan2023-plan2022)*0.3;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}else if(plan2023>=100) {
        								double rate2=(plan2023-plan2022)*0.1;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}
        							*/
        							if(rate>=100) rate=99.99;
        							if(rate<1) rate=1;
        							schoolRecord2020.setSubmitRate(df.format(rate));
        							schoolRecord2021.setSubmitRate(df.format(rate));
        							schoolRecord2022.setSubmitRate(df.format(rate));        						
        						}
        					}else {//全国学校，用全国同位分
        						if(qgj2020-avgGrade2020>0 &&qgj2021-avgGrade2021>0 &&qgj2022-avgGrade2022>0) {//3年的同位分都比录取平均分高
        							double rate=((qgj2022-avgGrade2022)/2+80)*0.55+((qgj2021-avgGrade2021)/2+80)*0.3+((qgj2020-avgGrade2020)/2+80)*0.15;
        							/*
        							if(plan2023<10) {
        								double rate2=plan2023-plan2022;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}else if(plan2023>=10&&plan2023<50) {
        								double rate2=(plan2023-plan2022)*0.5;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}else if(plan2023>=50&&plan2023<100) {
        								double rate2=(plan2023-plan2022)*0.3;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}else if(plan2023>=100) {
        								double rate2=(plan2023-plan2022)*0.1;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}
        							*/
        							if(rate>=100) rate=99.99;
        							if(rate<1) rate=1;
        							schoolRecord2020.setSubmitRate(df.format(rate));
        							schoolRecord2021.setSubmitRate(df.format(rate));
        							schoolRecord2022.setSubmitRate(df.format(rate));
        						}else {
        							
        							
        							double rate=0;
        							//2年高于
        							int count=0;
        							if(qgj2022-avgGrade2022>0) {
        								count++;
        							}
        							if(qgj2021-avgGrade2021>0) {
        								count++;
        							}
        							if(qgj2020-avgGrade2020>0) {
        								count++;
        							}
        							if(count==2) {//有2年高于同位分的
        								
        								if(qgj2022-avgGrade2022>0) {
        									rate=rate+((qgj2022-avgGrade2022)/2+70)*0.55;
        								}else {
        									rate=rate+((qgj2022-minGrade2022)/2+50)*0.55;
        								}
        								
        								if(qgj2021-avgGrade2021>0) {
        									rate=rate+((qgj2021-avgGrade2021)/2+70)*0.3;
        								}else {
        									rate=rate+((qgj2021-minGrade2021)/2+50)*0.3;
        								}
        								
        								if(qgj2020-avgGrade2020>0) {
        									rate=rate+((qgj2020-avgGrade2020)/2+70)*0.15;
        								}else {
        									rate=rate+((qgj2020-minGrade2020)/2+50)*0.15;
        								}
        							}else if(count==1) {//有1年高于同位分的
        								
        								if(qgj2022-avgGrade2022>0) {
        									rate=rate+((qgj2022-avgGrade2022)/2+60)*0.55;
        								}else {
        									rate=rate+((qgj2022-minGrade2022)/2+50)*0.55;
        								}
        								
        								if(qgj2021-avgGrade2021>0) {
        									rate=rate+((qgj2021-avgGrade2021)/2+60)*0.3;
        								}else {
        									rate=rate+((qgj2021-minGrade2021)/2+50)*0.3;
        								}
        								
        								if(qgj2020-avgGrade2020>0) {
        									rate=rate+((qgj2020-avgGrade2020)/2+60)*0.15;
        								}else {
        									rate=rate+((qgj2020-minGrade2020)/2+50)*0.15;
        								}
        								
        							}else {//一个高于的都没有
        								rate=((qgj2022-minGrade2022)/2+50)*0.55+((qgj2021-minGrade2021)/2+50)*0.3+((qgj2020-minGrade2020)/2+50)*0.15;
        							}
        							
        							/*
        							if(plan2023<10) {
        								double rate2=plan2023-plan2022;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}else if(plan2023>=10&&plan2023<50) {
        								double rate2=(plan2023-plan2022)*0.5;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}else if(plan2023>=50&&plan2023<100) {
        								double rate2=(plan2023-plan2022)*0.3;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}else if(plan2023>=100) {
        								double rate2=(plan2023-plan2022)*0.1;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}
        							*/
        							if(rate>=100) rate=99.99;
        							if(rate<1) rate=1;
        							schoolRecord2020.setSubmitRate(df.format(rate));
        							schoolRecord2021.setSubmitRate(df.format(rate));
        							schoolRecord2022.setSubmitRate(df.format(rate));        						
        						}
        					}
        				}else {//数据不满3年,3.  如果数据不满3年，只有2年，则剩下的两年各乘60%,40%。只有一年的录取数据的，乘100%。
        					int years=0;
        					if(avgGrade2020>0) years++;
        					if(avgGrade2021>0) years++;
        					if(avgGrade2022>0) years++;
        					if(years==2) {
        						
        						
        						
        						double rate=0;
        						if(provinceName.equals("广西")) {
        							
        							int heightYears=0;//这两年中，同位分大于平均分的年份数=2，则+70，如果年份数=1，则+60，都不大于平均分，则+50
            						if(avgGrade2022>0&&gxj2022-avgGrade2022>0) heightYears++;
            						if(avgGrade2021>0&&gxj2021-avgGrade2021>0) heightYears++;
            						if(avgGrade2020>0&&gxj2020-avgGrade2020>0) heightYears++;
        							
        							if(avgGrade2022>0) {//2022年有数据
        								if(heightYears==2) {
        									double rate1=((gxj2022-avgGrade2022)/2+70)*0.60;
            								rate=rate+rate1;
            								
            								if(avgGrade2021>0) {
                								double rate2=((gxj2021-avgGrade2021)/2+70)*0.40;
                								rate=rate+rate2;
                							}else {
                								double rate2=((gxj2020-avgGrade2020)/2+70)*0.40;
                								rate=rate+rate2;
                							}
        								}else if(heightYears==1) {
        									if(gxj2022-avgGrade2022>0) {
        										double rate1=((gxj2022-avgGrade2022)/2+60)*0.60;
                								rate=rate+rate1;
        									}else {
        										double rate1=((gxj2022-minGrade2022)/2+50)*0.60;
                								rate=rate+rate1;
        									}
        									if(avgGrade2021>0) {
	        									if(gxj2021-avgGrade2021>0) {
	        										double rate1=((gxj2021-avgGrade2021)/2+60)*0.40;
	                								rate=rate+rate1;
	        									}else {
	        										double rate1=((gxj2021-minGrade2021)/2+60)*0.40;
	                								rate=rate+rate1;
	        									}
        									}else {
        										if(gxj2020-avgGrade2020>0) {
	        										double rate1=((gxj2020-avgGrade2020)/2+60)*0.40;
	                								rate=rate+rate1;
	        									}else {
	        										double rate1=((gxj2020-minGrade2020)/2+60)*0.40;
	                								rate=rate+rate1;
	        									}
        									}
        								}else {//都不高于平均分
        									double rate1=((gxj2022-minGrade2022)/2+50)*0.60;
            								rate=rate+rate1;
            								if(avgGrade2021>0) {
            									double rate2=((gxj2021-minGrade2021)/2+50)*0.60;
                								rate=rate+rate2;
            								}else {
            									double rate2=((gxj2020-minGrade2020)/2+50)*0.40;
                								rate=rate+rate2;
            								}
        								}
        							}else {//2022年没数据，只有2021和2020年数据
        								if(heightYears==2) {
        									double rate1=((gxj2021-avgGrade2021)/2+70)*0.60+((gxj2020-avgGrade2020)/2+70)*0.40;
        									rate=rate+rate1;
        								}else if(heightYears==1) {
        									if(gxj2021-avgGrade2021>0) {
        										double rate1=((gxj2021-avgGrade2021)/2+60)*0.60;
        										rate=rate+rate1;
        									}else {
        										double rate1=((gxj2021-minGrade2021)/2+50)*0.60;
        										rate=rate+rate1;
        									}
        									if(gxj2020-avgGrade2020>0) {
        										double rate1=((gxj2020-avgGrade2020)/2+60)*0.40;
        										rate=rate+rate1;
        									}else {
        										double rate1=((gxj2020-minGrade2020)/2+50)*0.40;
        										rate=rate+rate1;
        									}
        								}else {
        									double rate1=((gxj2021-minGrade2021)/2+50)*0.60;
            								rate=rate+rate1;
                							
            								double rate2=((gxj2020-minGrade2020)/2+50)*0.40;
            								rate=rate+rate2;
        								}
        							}
        							
        						}else {//只有2年数据，全国的
        							int heightYears=0;//这两年中，同位分大于平均分的年份数=2，则+70，如果年份数=1，则+60，都不大于平均分，则+50
            						if(avgGrade2022>0&&qgj2022-avgGrade2022>0) heightYears++;
            						if(avgGrade2021>0&&qgj2021-avgGrade2021>0) heightYears++;
            						if(avgGrade2020>0&&qgj2020-avgGrade2020>0) heightYears++;
        							
        							if(avgGrade2022>0) {//2022年有数据
        								if(heightYears==2) {
        									double rate1=((qgj2022-avgGrade2022)/2+70)*0.60;
            								rate=rate+rate1;
            								
            								if(avgGrade2021>0) {
                								double rate2=((qgj2021-avgGrade2021)/2+70)*0.40;
                								rate=rate+rate2;
                							}else {
                								double rate2=((qgj2020-avgGrade2020)/2+70)*0.40;
                								rate=rate+rate2;
                							}
        								}else if(heightYears==1) {
        									if(qgj2022-avgGrade2022>0) {
        										double rate1=((qgj2022-avgGrade2022)/2+60)*0.60;
                								rate=rate+rate1;
        									}else {
        										double rate1=((qgj2022-minGrade2022)/2+50)*0.60;
                								rate=rate+rate1;
        									}
        									if(avgGrade2021>0) {
	        									if(qgj2021-avgGrade2021>0) {
	        										double rate1=((qgj2021-avgGrade2021)/2+60)*0.40;
	                								rate=rate+rate1;
	        									}else {
	        										double rate1=((qgj2021-minGrade2021)/2+60)*0.40;
	                								rate=rate+rate1;
	        									}
        									}else {
        										if(qgj2020-avgGrade2020>0) {
	        										double rate1=((qgj2020-avgGrade2020)/2+60)*0.40;
	                								rate=rate+rate1;
	        									}else {
	        										double rate1=((qgj2020-minGrade2020)/2+60)*0.40;
	                								rate=rate+rate1;
	        									}
        									}
        								}else {//都不高于平均分
        									double rate1=((qgj2022-minGrade2022)/2+50)*0.60;
            								rate=rate+rate1;
            								if(avgGrade2021>0) {
            									double rate2=((qgj2021-minGrade2021)/2+50)*0.60;
                								rate=rate+rate2;
            								}else {
            									double rate2=((qgj2020-minGrade2020)/2+50)*0.40;
                								rate=rate+rate2;
            								}
        								}
        							}else {//2022年没数据，只有2021和2020年数据
        								if(heightYears==2) {
        									double rate1=((qgj2021-avgGrade2021)/2+70)*0.60+((qgj2020-avgGrade2020)/2+70)*0.40;
        									rate=rate+rate1;
        								}else if(heightYears==1) {
        									if(qgj2021-avgGrade2021>0) {
        										double rate1=((qgj2021-avgGrade2021)/2+60)*0.60;
        										rate=rate+rate1;
        									}else {
        										double rate1=((qgj2021-minGrade2021)/2+50)*0.60;
        										rate=rate+rate1;
        									}
        									if(qgj2020-avgGrade2020>0) {
        										double rate1=((qgj2020-avgGrade2020)/2+60)*0.40;
        										rate=rate+rate1;
        									}else {
        										double rate1=((qgj2020-minGrade2020)/2+50)*0.40;
        										rate=rate+rate1;
        									}
        								}else {
        									double rate1=((qgj2021-minGrade2021)/2+50)*0.60;
            								rate=rate+rate1;
                							
            								double rate2=((qgj2020-minGrade2020)/2+50)*0.40;
            								rate=rate+rate2;
        								}
        							}
        							
        						}
        						
        						/*
        						if(plan2023<10) {
    								double rate2=plan2023-plan2022;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=10&&plan2023<50) {
    								double rate2=(plan2023-plan2022)*0.5;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=50&&plan2023<100) {
    								double rate2=(plan2023-plan2022)*0.3;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=100) {
    								double rate2=(plan2023-plan2022)*0.1;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}
    							*/
        						if(rate>=100) rate=99.99;
        						if(rate<1) rate=1;
        						schoolRecord2020.setSubmitRate(df.format(rate));
    							schoolRecord2021.setSubmitRate(df.format(rate));
    							schoolRecord2022.setSubmitRate(df.format(rate));    
        					}else {//只有一年数据
        						if(provinceName.equals("广西")) {

	        						if(avgGrade2022>0) {
	    								double rate=((gxj2022-minGrade2022)/2)+50;
	    								/*
	    								if(plan2023<10) {
	        								double rate2=plan2023-plan2022;
	        								if(rate2>30) rate2=30;
	        								if(rate2<-30) rate2=-30;
	        								rate=rate+rate2;
	        							}else if(plan2023>=10&&plan2023<50) {
	        								double rate2=(plan2023-plan2022)*0.5;
	        								if(rate2>30) rate2=30;
	        								if(rate2<-30) rate2=-30;
	        								rate=rate+rate2;
	        							}else if(plan2023>=50&&plan2023<100) {
	        								double rate2=(plan2023-plan2022)*0.3;
	        								if(rate2>30) rate2=30;
	        								if(rate2<-30) rate2=-30;
	        								rate=rate+rate2;
	        							}else if(plan2023>=100) {
	        								double rate2=(plan2023-plan2022)*0.1;
	        								if(rate2>30) rate2=30;
	        								if(rate2<-30) rate2=-30;
	        								rate=rate+rate2;
	        							}
	        							*/
	    								if(rate>=100) rate=99.99;
	    								if(rate<1) rate=1;
	    								schoolRecord2020.setSubmitRate(df.format(rate));
	        							schoolRecord2021.setSubmitRate(df.format(rate));
	        							schoolRecord2022.setSubmitRate(df.format(rate));    
	    							}
	        						if(avgGrade2021>0) {
	    								double rate=((gxj2021-minGrade2021)/2)+50;
	    								/*
	    								if(plan2023<10) {
	        								double rate2=plan2023-plan2022;
	        								if(rate2>30) rate2=30;
	        								if(rate2<-30) rate2=-30;
	        								rate=rate+rate2;
	        							}else if(plan2023>=10&&plan2023<50) {
	        								double rate2=(plan2023-plan2022)*0.5;
	        								if(rate2>30) rate2=30;
	        								if(rate2<-30) rate2=-30;
	        								rate=rate+rate2;
	        							}else if(plan2023>=50&&plan2023<100) {
	        								double rate2=(plan2023-plan2022)*0.3;
	        								if(rate2>30) rate2=30;
	        								if(rate2<-30) rate2=-30;
	        								rate=rate+rate2;
	        							}else if(plan2023>=100) {
	        								double rate2=(plan2023-plan2022)*0.1;
	        								if(rate2>30) rate2=30;
	        								if(rate2<-30) rate2=-30;
	        								rate=rate+rate2;
	        							}
	        							*/
	    								if(rate>=100) rate=99.99;
	    								if(rate<1) rate=1;
	    								schoolRecord2020.setSubmitRate(df.format(rate));
	        							schoolRecord2021.setSubmitRate(df.format(rate));
	        							schoolRecord2022.setSubmitRate(df.format(rate));    
	    							}
	        						if(avgGrade2020>0) {
	    								double rate=((gxj2020-minGrade2020)/2)+50;
	    								/*
	    								if(plan2023<10) {
	        								double rate2=plan2023-plan2022;
	        								if(rate2>30) rate2=30;
	        								if(rate2<-30) rate2=-30;
	        								rate=rate+rate2;
	        							}else if(plan2023>=10&&plan2023<50) {
	        								double rate2=(plan2023-plan2022)*0.5;
	        								if(rate2>30) rate2=30;
	        								if(rate2<-30) rate2=-30;
	        								rate=rate+rate2;
	        							}else if(plan2023>=50&&plan2023<100) {
	        								double rate2=(plan2023-plan2022)*0.3;
	        								if(rate2>30) rate2=30;
	        								if(rate2<-30) rate2=-30;
	        								rate=rate+rate2;
	        							}else if(plan2023>=100) {
	        								double rate2=(plan2023-plan2022)*0.1;
	        								if(rate2>30) rate2=30;
	        								if(rate2<-30) rate2=-30;
	        								rate=rate+rate2;
	        							}
	        							*/
	    								if(rate>=100) rate=99.99;
	    								if(rate<1) rate=1;
	    								schoolRecord2020.setSubmitRate(df.format(rate));
	        							schoolRecord2021.setSubmitRate(df.format(rate));
	        							schoolRecord2022.setSubmitRate(df.format(rate));    
	    							}
        						}else {//全国只有一年数据
        							if(avgGrade2022>0) {
	    								double rate=((qgj2022-minGrade2022)/2)+50;
	    								/*
	    								if(plan2023<10) {
	        								double rate2=plan2023-plan2022;
	        								if(rate2>30) rate2=30;
	        								if(rate2<-30) rate2=-30;
	        								rate=rate+rate2;
	        							}else if(plan2023>=10&&plan2023<50) {
	        								double rate2=(plan2023-plan2022)*0.5;
	        								if(rate2>30) rate2=30;
	        								if(rate2<-30) rate2=-30;
	        								rate=rate+rate2;
	        							}else if(plan2023>=50&&plan2023<100) {
	        								double rate2=(plan2023-plan2022)*0.3;
	        								if(rate2>30) rate2=30;
	        								if(rate2<-30) rate2=-30;
	        								rate=rate+rate2;
	        							}else if(plan2023>=100) {
	        								double rate2=(plan2023-plan2022)*0.1;
	        								if(rate2>30) rate2=30;
	        								if(rate2<-30) rate2=-30;
	        								rate=rate+rate2;
	        							}
	        							*/
	    								if(rate>=100) rate=99.99;
	    								if(rate<1) rate=1;
	    								schoolRecord2020.setSubmitRate(df.format(rate));
	        							schoolRecord2021.setSubmitRate(df.format(rate));
	        							schoolRecord2022.setSubmitRate(df.format(rate));    
	    							}
	        						if(avgGrade2021>0) {
	    								double rate=((qgj2021-minGrade2021)/2)+50;
	    								/*
	    								if(plan2023<10) {
	        								double rate2=plan2023-plan2022;
	        								if(rate2>30) rate2=30;
	        								if(rate2<-30) rate2=-30;
	        								rate=rate+rate2;
	        							}else if(plan2023>=10&&plan2023<50) {
	        								double rate2=(plan2023-plan2022)*0.5;
	        								if(rate2>30) rate2=30;
	        								if(rate2<-30) rate2=-30;
	        								rate=rate+rate2;
	        							}else if(plan2023>=50&&plan2023<100) {
	        								double rate2=(plan2023-plan2022)*0.3;
	        								if(rate2>30) rate2=30;
	        								if(rate2<-30) rate2=-30;
	        								rate=rate+rate2;
	        							}else if(plan2023>=100) {
	        								double rate2=(plan2023-plan2022)*0.1;
	        								if(rate2>30) rate2=30;
	        								if(rate2<-30) rate2=-30;
	        								rate=rate+rate2;
	        							}
	        							*/
	    								if(rate>=100) rate=99.99;
	    								if(rate<1) rate=1;
	    								schoolRecord2020.setSubmitRate(df.format(rate));
	        							schoolRecord2021.setSubmitRate(df.format(rate));
	        							schoolRecord2022.setSubmitRate(df.format(rate));    
	    							}
	        						if(avgGrade2020>0) {
	    								double rate=((qgj2020-minGrade2020)/2)+50;
	    								/*
	    								if(plan2023<10) {
	        								double rate2=plan2023-plan2022;
	        								if(rate2>30) rate2=30;
	        								if(rate2<-30) rate2=-30;
	        								rate=rate+rate2;
	        							}else if(plan2023>=10&&plan2023<50) {
	        								double rate2=(plan2023-plan2022)*0.5;
	        								if(rate2>30) rate2=30;
	        								if(rate2<-30) rate2=-30;
	        								rate=rate+rate2;
	        							}else if(plan2023>=50&&plan2023<100) {
	        								double rate2=(plan2023-plan2022)*0.3;
	        								if(rate2>30) rate2=30;
	        								if(rate2<-30) rate2=-30;
	        								rate=rate+rate2;
	        							}else if(plan2023>=100) {
	        								double rate2=(plan2023-plan2022)*0.1;
	        								if(rate2>30) rate2=30;
	        								if(rate2<-30) rate2=-30;
	        								rate=rate+rate2;
	        							}
	        							*/
	    								if(rate>=100) rate=99.99;
	    								if(rate<1) rate=1;
	    								schoolRecord2020.setSubmitRate(df.format(rate));
	        							schoolRecord2021.setSubmitRate(df.format(rate));
	        							schoolRecord2022.setSubmitRate(df.format(rate));    
	    							}
        						}
        					}
        				}


						/**
						 * 旧的投档概率只占20%，跟2024年最低录取分数线比较的概率，占80%
						 * 专业组投档概率:今年的考生输入分数a后先和去年的院校专业组投档线b比较，
						 * 如果一样的分数投档概率为50%，以2分为1%的基数，得出一个概率c,比如a=460，b=450,
						 * 那么c=(460－450)÷2+50%=55%，系统现在显示的概率为d,假如现在系统显示的投档概率为50%，
						 * 如果现在定的最终概率为e,那么e=(55%X80+50%X20%）÷2=54%
						 */

						for(int s=0;s<plans2024List.size();s++){
							SchoolPlan plan2024= plans2024List.get(s);
							//学校和专业组相等
							if(plan2024.getSchoolCode().equals(schoolRecord2022.getScode())
									&&plan2024.getZyz().equals(schoolRecord2022.getZyz())){
								//最低录取分数线
								int grade=plan2024.getGrade();
								int memberGrade=memberQuery.getGrade();
								//if(schoolRecord2022.getSubmitRate()!=null) {
									//double rate=new Double(schoolRecord2022.getSubmitRate());
									//((考生成绩-录取最低分)/2+50)*0.8+schoolRecord2022.getSubmitRate()*0.2
									//double finalRate = ((memberGrade - grade) / 2 + 50) * 0.8 + rate * 0.2;
                                double finalRate = (memberGrade - grade) / 2 + 50;

									if(finalRate>=100) finalRate=99.99;
									if(finalRate<1) finalRate=1;
								if(schoolRecord2022.getMinGrade()!=null&&schoolRecord2021.getMinGrade()!=null&&schoolRecord2020.getMinGrade()!=null){
									schoolRecord2020.setSubmitRate(df.format(finalRate));
									schoolRecord2021.setSubmitRate(df.format(finalRate));
									schoolRecord2022.setSubmitRate(df.format(finalRate));
								}else{
									schoolRecord2020.setSubmitRate("-");
									schoolRecord2021.setSubmitRate("-");
									schoolRecord2022.setSubmitRate("-");
								}
								//}

							}
						}
        				
        				if(schoolRecord2022.getSubmitRate()==null) {
        					schoolRecord2022.setSubmitRate("-");
        				}
        				if(schoolRecord2022.getPlanSubmitAdmission()==null) {
        					schoolRecord2022.setPlanSubmitAdmission("-");
        				}
        				
        				
        				if(schoolRecord2022.getAvgGradeSeq()==null||schoolRecord2022.getAvgGradeSeq().equals("99999999")) {
        					schoolRecord2022.setAvgGradeSeq("-");
        				}
        				
        				if(schoolRecord2022.getMinGradeSeq()==null||schoolRecord2022.getMinGradeSeq().equals("99999999")) {
        					schoolRecord2022.setMinGradeSeq("-");
        				}
        				
        				
        				if(schoolRecord2021.getSubmitRate()==null) {
        					schoolRecord2021.setSubmitRate("-");
        					
        				}
        				if(schoolRecord2021.getPlanSubmitAdmission()==null) {
        					schoolRecord2021.setPlanSubmitAdmission("-");
        				}
        				
        				
        				if(schoolRecord2021.getAvgGradeSeq()==null||schoolRecord2021.getAvgGradeSeq().equals("99999999")) {
        					schoolRecord2021.setAvgGradeSeq("-");
        				}
        				
        				if(schoolRecord2021.getMinGradeSeq()==null||schoolRecord2021.getMinGradeSeq().equals("99999999")) {
        					schoolRecord2021.setMinGradeSeq("-");
        				}
        				
        				
        				if(schoolRecord2020.getSubmitRate()==null) {
        					schoolRecord2020.setSubmitRate("-");
        				}
        				if(schoolRecord2020.getPlanSubmitAdmission()==null) {
        					schoolRecord2020.setPlanSubmitAdmission("-");
        				}
        				
        				
        				if(schoolRecord2020.getAvgGradeSeq()==null||schoolRecord2020.getAvgGradeSeq().equals("99999999")) {
        					schoolRecord2020.setAvgGradeSeq("-");
        				}
        				
        				if(schoolRecord2020.getMinGradeSeq()==null||schoolRecord2020.getMinGradeSeq().equals("99999999")) {
        					schoolRecord2020.setMinGradeSeq("-");
        				}
        				
        				
        				if(submitType==null||submitType.trim().equals("")) {
        					submitType="L";
        				}
        				
        				
        				String submitRate=schoolRecord2022.getSubmitRate();
        				if(submitRate!=null&&!submitRate.equals("-")) {
        					double rate=new Double(submitRate);
        					if("L".equals(submitType)) {
            					if(rate<60) {
            						returnList.add(schoolRecord2022);
        	        				returnList.add(schoolRecord2021);
        	        				returnList.add(schoolRecord2020);
            					}
            				}
        					if("M".equals(submitType)) {
        						if(rate>=60&&rate<90) {
        							returnList.add(schoolRecord2022);
        	        				returnList.add(schoolRecord2021);
        	        				returnList.add(schoolRecord2020);
        						}
        					}
        					if("H".equals(submitType)) {
        						if(rate>=90) {
        							returnList.add(schoolRecord2022);
        	        				returnList.add(schoolRecord2021);
        	        				returnList.add(schoolRecord2020);
        						}
        					}
        				}
        				
        				
        			}//循环专业组，学校相同结束
        			
        			
        			
        		}
        		
        		
        	}
        			
        }
        
        Map map=new HashMap();
        map.put("pageNum", pageNum);
        map.put("returnList", returnList);
        
        return AjaxResult.success(map);
    }





	@ApiOperation("选科详情")
	@GetMapping("/xuanke_detail")
	public AjaxResult xuanke_detail(String schoolCode,String sxkm,String zxkm,String userId) {

		if (userId == null || userId.equals("")) {
			return AjaxResult.error("请先登录");
		}

		if (isSpecialChar(userId.toString()) || sqlValidate(userId.toString())) {
			AjaxResult.error("参数包含非法字符");
		}

		BuzMember memberQuery = buzMemberService.selectBuzMemberById(userId);

		if (memberQuery != null && memberQuery.getPhone() != null) {

		} else {

			return AjaxResult.error("会员信息不存在，请先注册成为会员");
		}

		if (memberQuery.getSfvip().intValue() == 0) {
			return AjaxResult.error("系统已更新，非会员不能查询");
		}

		if (schoolCode == null || schoolCode.trim().equals("")) {

			return AjaxResult.error("请选择学校");
		}

		if (isSpecialChar(schoolCode.toString()) || sqlValidate(schoolCode.toString())) {
			AjaxResult.error("参数包含非法字符");
		}

		if (isSpecialChar(sxkm.toString()) || sqlValidate(sxkm.toString())) {
			AjaxResult.error("参数包含非法字符");
		}

		if (isSpecialChar(zxkm.toString()) || sqlValidate(zxkm.toString())) {
			AjaxResult.error("参数包含非法字符");
		}

		Map map = new HashMap();

		map.put("member", memberQuery);


		School schoolQuery = new School();


		if ("物理".equals(sxkm)) {
			schoolQuery.setMajorType("理工类");
		}
		if ("历史".equals(sxkm)) {
			schoolQuery.setMajorType("文史类");
		}



		if(zxkm!=null) {
			//考生的再选科目
			if(zxkm.substring(zxkm.length()-1,zxkm.length()).equals(",")){
				zxkm=zxkm.substring(0,zxkm.length()-1);
			}
			schoolQuery.setZxkm(zxkm);
		}

		schoolQuery.setScode(schoolCode);

		int pageRow=0;

		schoolQuery.setPageNum(pageRow);

		List<School> list = schoolService.selectSchoolList4Page(schoolQuery);
		if(list!=null&&list.size()>0) {
			School school = list.get(0);
			map.put("school", school);


			//查询专业组
			SchoolPlan schoolPlanQuery=new SchoolPlan();
			schoolPlanQuery.setYear(thisYear);
			schoolPlanQuery.setSchoolCode(schoolCode);
			if("物理".equals(sxkm)) {
				schoolPlanQuery.setMajorType("理工类");
			}
			if("历史".equals(sxkm)) {
				schoolPlanQuery.setMajorType("文史类");
			}

			//考生的再选科目
			schoolPlanQuery.setZxkm(zxkm);


			//如果会员不是少数民族，则不能查询民族班

			schoolQuery.setSsmzFlag(0);
			schoolQuery.setGjzxFlag(0);
			schoolQuery.setGxzxFlag(0);



			List<SchoolPlan> zyList =schoolPlanService.selectSchoolPlanList(schoolPlanQuery);

			for(int i=0;i<zyList.size();i++){
				SchoolPlan plan=zyList.get(i);
				String km1=plan.getKm1();
			}

			map.put("zyzList", zyList);
		}

		return AjaxResult.success(map);

	}


	@ApiOperation("专业详情")
	@GetMapping("/show_zy_detail")
	public AjaxResult show_zy_detail(String majorCode,String userId) {

		if (userId == null || userId.equals("")) {
			return AjaxResult.error("请先登录");
		}

		if (isSpecialChar(userId.toString()) || sqlValidate(userId.toString())) {
			AjaxResult.error("参数包含非法字符");
		}

		BuzMember memberQuery = buzMemberService.selectBuzMemberById(userId);

		if (memberQuery != null && memberQuery.getPhone() != null) {

		} else {

			return AjaxResult.error("会员信息不存在，请先注册成为会员");
		}

		if (memberQuery.getSfvip().intValue() == 0) {
			return AjaxResult.error("系统已更新，非会员不能查询");
		}

		if (majorCode == null || majorCode.trim().equals("")) {

			return AjaxResult.error("请选择专业");
		}

		if (isSpecialChar(majorCode.toString()) || sqlValidate(majorCode.toString())) {
			AjaxResult.error("参数包含非法字符");
		}


		Map map = new HashMap();



		SMajors majorsQuery = new SMajors();
		majorsQuery.setMcode(majorCode);

		List<SMajors> list=sMajorsService.selectSMajorsList(majorsQuery);
		if(list!=null&&list.size()>0){
			SMajors majors=list.get(0);
			map.put("majors",majors);
		}






		return AjaxResult.success(map);

	}


		/************
         *
         * @param schoolCode
         * @param fxTypes
         * @param userId
         * @return
         * 返回内容为：
         * 1个school对象
         * 1个专业组数组
         * 第一个专业组的投档概率（3条记录）
         * 第一个专业组下个专业的投档概率（每个专业3条记录）
         */
    @ApiOperation("综合分析详情")
    @GetMapping("/zhfx_detail")
    public AjaxResult zhfx_detail(String schoolCode,String schoolCodeInput,String schoolName,String fxTypes,String userId,String zyz)
    {
    	
    	if(userId==null||userId.equals("")) {
    		return AjaxResult.error("请先登录");
    	}
    	
    	if(isSpecialChar(userId.toString())||sqlValidate(userId.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	BuzMember memberQuery=buzMemberService.selectBuzMemberById(userId);

    	if(memberQuery!=null&&memberQuery.getPhone()!=null) {
    		
    	}else {
    		
    		return AjaxResult.error("会员信息不存在，请先注册成为会员");
    	}
    	
    	if(memberQuery.getSfvip().intValue()==0) {
        	return AjaxResult.error("系统已更新，非会员不能查询");
        }

//查找会员的同位分
		BuzMemberGrade memberGradeQuery=new BuzMemberGrade();
		memberGradeQuery.setMemberId(memberQuery.getId());
		List<BuzMemberGrade> memberGradeList=buzMemberGradeService.selectBuzMemberGradeList(memberGradeQuery);
    	
    	Map map=new HashMap();

		String memo="您是"+thisYear+"的考生，您的科目组是"+memberQuery.getSxkm()+"+"+memberQuery.getZxkm()+"，"
				+"您的高考总分为"+memberQuery.getQggrade()+"（区外院校排名"+memberQuery.getGradePm()
				+"，区内院校排名"+memberQuery.getGradePmGx()+"）。今年"
				+memberQuery.getSxkm()+"类本科分数线是";
		if("物理".equals(memberQuery.getSxkm())) {
			memo=memo+thisYearLgGradeLine+"分（区外排名"+thisYearLgQgpm
					+"，区内排名"+thisYearLgGxpm+"），分析到区外或广西区内院校时，系统会自动转换名次来分析。该院校专业组今年的招生计划数为";
		}else{
			memo=memo+thisYearWsGradeLine+"分（区外排名"+thisYearWsQgpm
					+"，区内排名"+thisYearLgGxpm+"），分析到区外或广西区内院校时，系统会自动转换名次来分析。该院校专业组今年的招生计划数为";
		}

		/*
		memberQuery.setYear(thisYear);


		if("物理".equals(memberQuery.getSxkm())) {
			memberQuery.setGradeLine(thisYearLgGradeLine);
			memberQuery.setGradePm(thisYearLgQgpm);
			memberQuery.setGradePmGx(thisYearLgGxpm);
		}else{
			memberQuery.setGradeLine(thisYearWsGradeLine);
			memberQuery.setGradePm(thisYearWsQgpm);
			memberQuery.setGradePmGx(thisYearWsGxpm);
		}

		 */
    	

    	
    	
    	School schoolQuery=new School();
        
        
        if("物理".equals(memberQuery.getSxkm())) {
        	schoolQuery.setMajorType("理工类");
    	}
    	if("历史".equals(memberQuery.getSxkm())) {
    		schoolQuery.setMajorType("文史类");
    	}
    	
    	
    	//如果会员不是少数民族，则不能查询民族班
    	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
    		schoolQuery.setSsmzFlag(0);
    	}
    	
    	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
    		schoolQuery.setGjzxFlag(0);
    	}
    	
    	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
    		schoolQuery.setGxzxFlag(0);
    	}


        School school=null;

    	String sCode="";
        String sName="";
    	//考生的再选科目
    	schoolQuery.setZxkm(memberQuery.getZxkm());
        if(schoolCode!=null&&!schoolCode.trim().equals("")) {
            sCode=schoolCode;

        }else if(schoolCodeInput!=null&&!schoolCodeInput.trim().equals("")) {
            sCode=schoolCodeInput;
        }else if(schoolName!=null&&!schoolName.trim().equals("")) {
            sName=schoolName;
        }else{
            return AjaxResult.error("请选择学校");
        }
        if(sName!=null&&!sName.equals("")){
            if(isSpecialChar(sName.toString())||sqlValidate(sName.toString())){
                AjaxResult.error("参数包含非法字符");
            }
            //根据学校名称查找学校信息
            List<School> list = schoolService.selectSchoolBySname(sName);
            if(list!=null&&list.size()>0){
                school=list.get(0);
            }
        }else if(sCode!=null&&!sCode.equals("")){
            if(isSpecialChar(sCode.toString())||sqlValidate(sCode.toString())){
                AjaxResult.error("参数包含非法字符");
            }
            List<School> list = schoolService.selectByScodeschool(sCode);
            if(list!=null&&list.size()>0){
                school=list.get(0);
            }
        }else{
            return AjaxResult.error("请选择学校");
        }

        if(school==null){
            return AjaxResult.error("学校编码或者或许名称填写错误");
        }else{


            schoolCode=school.getScode();



        
            List<SysDictData> dataList = dictTypeService.selectDictDataByType("school_level");

        	String collegeLevel=school.getCollegeLevel();
        	if(collegeLevel!=null&&!collegeLevel.trim().equals("")) {
        		String collegeLevelStr="";
        		String[] collegeLevelArr= collegeLevel.split(",");
        		for(int i=0;i<dataList.size();i++) {
        			SysDictData data= dataList.get(i);
        			for(int j=0;j<collegeLevelArr.length;j++) {
        				if(data.getDictValue().equals(collegeLevelArr[j])) {
        					collegeLevelStr=collegeLevelStr+"<span>"+data.getDictLabel()+"</span>";
        				}
        			}
        		}
        		
        		school.setCollegeLevel(collegeLevelStr);
        	}






        	

        	
        	String provinceName=school.getProvinceName();


        	schoolCode="'"+schoolCode+"'";
        	
        	//查询专业组
        	SchoolPlan schoolPlanQuery=new SchoolPlan();
        	schoolPlanQuery.setYear(thisYear);
        	schoolPlanQuery.setSchoolCode(schoolCode);
        	if("物理".equals(memberQuery.getSxkm())) {
        		schoolPlanQuery.setMajorType("理工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		schoolPlanQuery.setMajorType("文史类");
        	}
        	
        	
        	//如果会员不是少数民族，则不能查询民族班
        	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
        		schoolPlanQuery.setSsmzFlag(0);
        	}
        	
        	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
        		schoolPlanQuery.setGjzxFlag(0);
        	}
        	
        	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
        		schoolPlanQuery.setGxzxFlag(0);
        	}
        	
        	//考生的再选科目
        	schoolPlanQuery.setZxkm(memberQuery.getZxkm());
        	
        	//List<SchoolPlan> zyzList =schoolPlanService.selectSchoolZyzList(schoolPlanQuery);
        	
        	List<SchoolPlan> zyzTabList =schoolPlanService.selectSchoolZyzPlanList(schoolPlanQuery);
        	
        	map.put("zyzList", zyzTabList);//用于切换专业组用


        	//List<SchoolPlan> plans2023List =schoolPlanService.selectSchoolZyz2023PlanList(schoolPlanQuery);

			SchoolPlan zyzPlan = null;
			if(zyzTabList!=null&&zyzTabList.size()>0) {
				if(zyz!=null&&!zyz.equals("")){
					for(int i=0;i<zyzTabList.size();i++){
						SchoolPlan plan=zyzTabList.get(i);
						if(zyz.equals(plan.getZyz())){
							zyzPlan =plan;
						}
					}
				}else{
					zyzPlan=zyzTabList.get(0);
				}
			}

			//该学校该专业组今年的招生计划人数
			if(zyzPlan!=null&&zyzPlan.getZyzPlan()!=null){
				memo=memo+zyzPlan.getZyzPlan();
			}else{

			}
			memo=memo+"，您的院校专业组投档概率及专业录取概率分析如下:";
			memberQuery.setMemo(memo);
			school.setZyz(zyzPlan.getZyz());

			if(zyzPlan.getZyzPlan()!=null) {

				school.setPlan(zyzPlan.getZyzPlan().toString());
			}else{
				school.setPlan("-");
			}
			map.put("school", school);


			//专业组近3年的数据
			schoolPlanQuery.setYear3(yearNew1+","+yearNew2+","+yearNew3);
			schoolPlanQuery.setZyz(zyzPlan.getZyz());
			List<SchoolPlan> zyzList =schoolPlanService.selectSchoolZyzPlanList3Year(schoolPlanQuery);



			List<SchoolPlan> plans2024List =schoolPlanService.selectSchoolZyz2024PlanList(schoolPlanQuery);



			//该专业组下的所有专业近3年的数据
			List<SchoolPlan> majorList =schoolPlanService.selectSchoolMajorList3Year(schoolPlanQuery);
			//有些专业的数据并不是近3年都有，所以需要去重后，以这个专业作为循环
			//这个地方错了，应该是拿这个专业组2024年下的专业来作为循环
			schoolPlanQuery.setYear3(new Integer(thisYear).toString());
			List<SchoolPlan> distinctMajorList =schoolPlanService.selectSchoolDistinctMajorList3Year(schoolPlanQuery);
        	

        	//专业组投档概率
        	List<School> returnList =new ArrayList();
        	
        	
        	DecimalFormat df = new DecimalFormat("#.00");
        	//开始计算专业组投档率

			zyz=zyzPlan.getZyz();




			//当年招生数量，从招生计划取
			int plan2023=0;

			School schoolRecord2022=new School();
			schoolRecord2022.setProvinceName(provinceName);
			schoolRecord2022.setSname(school.getSname());
			schoolRecord2022.setScode(school.getScode());
			schoolRecord2022.setZyz(zyz);
			schoolRecord2022.setZxkm(zyzPlan.getKm2());
			schoolRecord2022.setYear(yearNew1);
			schoolRecord2022.setSranking(school.getSranking());

			if("物理".equals(memberQuery.getSxkm())) {
				schoolRecord2022.setGradeLine(new Integer(gradeLineLg2022).toString());
			}else{
				schoolRecord2022.setGradeLine(new Integer(gradeLineWs2022).toString());
			}

			/**
			 * 计算当年的排名和对应的分数
			 */
			if(provinceName.equals("广西")) {

				if(memberGradeList!=null&&memberGradeList.size()>0){
					for(int k=0;k<memberGradeList.size();k++){
						BuzMemberGrade memberGrade=memberGradeList.get(k);
						if(memberGrade.getYear().intValue()==yearNew1){
							if(memberGrade.getPmGradeGx()!=null) {
								schoolRecord2022.setSeqGrade(memberGrade.getPmGradeGx().toString());
							}else{
								schoolRecord2022.setSeqGrade("-");
							}
						}
					}
				}

				if(memberQuery.getGradePmGx()!=null) {
					schoolRecord2022.setSeq(memberQuery.getGradePmGx().toString());
				}else{
					schoolRecord2022.setSeq("-");
				}
			}else {

				if(memberGradeList!=null&&memberGradeList.size()>0){
					for(int k=0;k<memberGradeList.size();k++){
						BuzMemberGrade memberGrade=memberGradeList.get(k);
						if(memberGrade.getYear().intValue()==yearNew1){
							if(memberGrade.getPmGradeGx()!=null) {
								schoolRecord2022.setSeqGrade(memberGrade.getPmGrade().toString());
							}else{
								schoolRecord2022.setSeqGrade("-");
							}
						}
					}
				}

				if(memberQuery.getGradePm()!=null) {
					schoolRecord2022.setSeq(memberQuery.getGradePm().toString());
				}else{
					schoolRecord2022.setSeq("-");
				}

			}

			/**
			 * 计算当年最低分，最低分排名，平均分，平均分对应的排名
			 */
			SchoolPlan zyz2022=null;
			for(int k=0;k<zyzList.size();k++) {
				SchoolPlan school3 = zyzList.get(k);
				if (school3.getYear().intValue() == yearNew1 &&
						school3.getSchoolCode().equals(school.getScode()) &&
						school3.getZyz().equals(school.getZyz())) {
					zyz2022=school3;
					break;

				}
			}
			if(zyz2022!=null){
				if(zyz2022.getZyzAvgGrade()!=null){
					schoolRecord2022.setAvgGrade(zyz2022.getZyzAvgGrade().toString());
				}else{
					schoolRecord2022.setAvgGrade("-");
				}
				if(zyz2022.getZyzLowGrade()!=null){
					schoolRecord2022.setMinGrade(zyz2022.getZyzLowGrade().toString());
				}else{
					schoolRecord2022.setMinGrade("-");
				}
				if(zyz2022.getZyzLowPm()!=null){
					schoolRecord2022.setMinGradeSeq(zyz2022.getZyzLowPm().toString());
				}else{
					schoolRecord2022.setMinGradeSeq("-");
				}
				if(zyz2022.getZyzAvgPm()!=null){
					schoolRecord2022.setAvgGradeSeq(zyz2022.getZyzAvgPm().toString());
				}else{
					schoolRecord2022.setAvgGradeSeq("-");
				}
				String planSubmitAdmission="";
				if(zyz2022.getZyzPlan()!=null){
					schoolRecord2022.setPlan(zyz2022.getZyzPlan().toString());
					planSubmitAdmission=zyz2022.getZyzPlan().toString();
				}else{
					schoolRecord2022.setPlan("-");
				}
				if(zyz2022.getZyzAdmin()!=null){
					schoolRecord2022.setSubmit(zyz2022.getZyzAdmin().toString());
					planSubmitAdmission=planSubmitAdmission+"-"+zyz2022.getZyzAdmin().toString();
				}else{
					schoolRecord2022.setSubmit("-");
					if(zyz2022.getZyzPlan()!=null){
						planSubmitAdmission=planSubmitAdmission+"-";
					}
				}
				schoolRecord2022.setPlanSubmitAdmission(planSubmitAdmission);
			}else{
				schoolRecord2022.setAvgGrade("-");
				schoolRecord2022.setMinGrade("-");
				schoolRecord2022.setAvgGradeSeq("-");
				schoolRecord2022.setMinGradeSeq("-");
				schoolRecord2022.setPlan("-");
				schoolRecord2022.setSubmit("-");
				schoolRecord2022.setPlanSubmitAdmission("-");
			}
				

        		
			School schoolRecord2021=new School();
			schoolRecord2021.setProvinceName(provinceName);
			schoolRecord2021.setSname(school.getSname());
			schoolRecord2021.setScode(school.getScode());
			schoolRecord2021.setZyz(zyz);
			schoolRecord2021.setZxkm(zyzPlan.getKm2());
			schoolRecord2021.setYear(yearNew2);
			schoolRecord2021.setSranking(school.getSranking());

			if("物理".equals(memberQuery.getSxkm())) {
				schoolRecord2021.setGradeLine(new Integer(gradeLineLg2021).toString());
			}else{
				schoolRecord2021.setGradeLine(new Integer(gradeLineWs2021).toString());
			}

			if(provinceName.equals("广西")) {
				if(memberGradeList!=null&&memberGradeList.size()>0){
					for(int k=0;k<memberGradeList.size();k++){
						BuzMemberGrade memberGrade=memberGradeList.get(k);
						if(memberGrade.getYear().intValue()==yearNew2){
							if(memberGrade.getPmGradeGx()!=null) {
								schoolRecord2021.setSeqGrade(memberGrade.getPmGradeGx().toString());
							}else{
								schoolRecord2021.setSeqGrade("-");
							}
						}
					}
				}

				if(memberQuery.getGradePmGx()!=null) {
					schoolRecord2021.setSeq(memberQuery.getGradePmGx().toString());
				}else{
					schoolRecord2021.setSeq("-");
				}
			}else {

				if(memberGradeList!=null&&memberGradeList.size()>0){
					for(int k=0;k<memberGradeList.size();k++){
						BuzMemberGrade memberGrade=memberGradeList.get(k);
						if(memberGrade.getYear().intValue()==yearNew2){
							if(memberGrade.getPmGradeGx()!=null) {
								schoolRecord2021.setSeqGrade(memberGrade.getPmGrade().toString());
							}else{
								schoolRecord2021.setSeqGrade("-");
							}
						}
					}
				}

				if(memberQuery.getGradePm()!=null) {
					schoolRecord2021.setSeq(memberQuery.getGradePm().toString());
				}else{
					schoolRecord2021.setSeq("-");
				}
			}


			/**
			 * 计算当年最低分，最低分排名，平均分，平均分对应的排名
			 */
			SchoolPlan zyz2021=null;
			for(int k=0;k<zyzList.size();k++) {
				SchoolPlan school3 = zyzList.get(k);
				if (school3.getYear().intValue() == yearNew2 &&
						school3.getSchoolCode().equals(school.getScode()) &&
						school3.getZyz().equals(school.getZyz())) {
					zyz2021=school3;
					break;

				}
			}
			if(zyz2021!=null){
				if(zyz2021.getZyzAvgGrade()!=null){
					schoolRecord2021.setAvgGrade(zyz2021.getZyzAvgGrade().toString());
				}else{
					schoolRecord2021.setAvgGrade("-");
				}
				if(zyz2021.getZyzLowGrade()!=null){
					schoolRecord2021.setMinGrade(zyz2021.getZyzLowGrade().toString());
				}else{
					schoolRecord2021.setMinGrade("-");
				}
				if(zyz2021.getZyzLowPm()!=null){
					schoolRecord2021.setMinGradeSeq(zyz2021.getZyzLowPm().toString());
				}else{
					schoolRecord2021.setMinGradeSeq("-");
				}
				if(zyz2021.getZyzAvgPm()!=null){
					schoolRecord2021.setAvgGradeSeq(zyz2021.getZyzAvgPm().toString());
				}else{
					schoolRecord2021.setAvgGradeSeq("-");
				}
				String planSubmitAdmission="";
				if(zyz2021.getZyzPlan()!=null){
					schoolRecord2021.setPlan(zyz2021.getZyzPlan().toString());
					planSubmitAdmission=zyz2021.getZyzPlan().toString();
				}else{
					schoolRecord2021.setPlan("-");
				}
				if(zyz2021.getZyzAdmin()!=null){
					schoolRecord2021.setSubmit(zyz2021.getZyzAdmin().toString());
					planSubmitAdmission=planSubmitAdmission+"-"+zyz2021.getZyzAdmin().toString();
				}else{
					schoolRecord2021.setSubmit("-");
					if(zyz2021.getZyzPlan()!=null){
						planSubmitAdmission=planSubmitAdmission+"-";
					}
				}
				schoolRecord2021.setPlanSubmitAdmission(planSubmitAdmission);
			}else{
				schoolRecord2021.setAvgGrade("-");
				schoolRecord2021.setMinGrade("-");
				schoolRecord2021.setAvgGradeSeq("-");
				schoolRecord2021.setMinGradeSeq("-");
				schoolRecord2021.setPlan("-");
				schoolRecord2021.setSubmit("-");
				schoolRecord2021.setPlanSubmitAdmission("-");
			}
				
				
			School schoolRecord2020=new School();
			schoolRecord2020.setProvinceName(provinceName);
			schoolRecord2020.setSname(school.getSname());
			schoolRecord2020.setScode(school.getScode());
			schoolRecord2020.setZyz(zyz);
			schoolRecord2020.setZxkm(zyzPlan.getKm2());
			schoolRecord2020.setYear(yearNew3);
			schoolRecord2020.setSranking(school.getSranking());

			if("物理".equals(memberQuery.getSxkm())) {
				schoolRecord2020.setGradeLine(new Integer(gradeLineLg2020).toString());
			}else{
				schoolRecord2020.setGradeLine(new Integer(gradeLineWs2020).toString());
			}


			if(provinceName.equals("广西")) {

				if(memberGradeList!=null&&memberGradeList.size()>0){
					for(int k=0;k<memberGradeList.size();k++){
						BuzMemberGrade memberGrade=memberGradeList.get(k);
						if(memberGrade.getYear().intValue()==yearNew3){
							if(memberGrade.getPmGradeGx()!=null) {
								schoolRecord2020.setSeqGrade(memberGrade.getPmGradeGx().toString());
							}else{
								schoolRecord2020.setSeqGrade("-");
							}
						}
					}
				}

				if(memberQuery.getGradePmGx()!=null) {
					schoolRecord2020.setSeq(memberQuery.getGradePmGx().toString());
				}else{
					schoolRecord2020.setSeq("-");
				}
			}else {

				if(memberGradeList!=null&&memberGradeList.size()>0){
					for(int k=0;k<memberGradeList.size();k++){
						BuzMemberGrade memberGrade=memberGradeList.get(k);
						if(memberGrade.getYear().intValue()==yearNew3){
							if(memberGrade.getPmGradeGx()!=null) {
								schoolRecord2020.setSeqGrade(memberGrade.getPmGrade().toString());
							}else{
								schoolRecord2020.setSeqGrade("-");
							}
						}
					}
				}

				if(memberQuery.getGradePm()!=null) {
					schoolRecord2020.setSeq(memberQuery.getGradePm().toString());
				}else{
					schoolRecord2020.setSeq("-");
				}

			}

			/**
			 * 计算当年最低分，最低分排名，平均分，平均分对应的排名
			 */
			SchoolPlan zyz2020=null;
			for(int k=0;k<zyzList.size();k++) {
				SchoolPlan school3 = zyzList.get(k);
				if (school3.getYear().intValue() == yearNew3 &&
						school3.getSchoolCode().equals(school.getScode()) &&
						school3.getZyz().equals(school.getZyz())) {
					zyz2020=school3;
					break;

				}
			}
			if(zyz2020!=null){
				if(zyz2020.getZyzAvgGrade()!=null){
					schoolRecord2020.setAvgGrade(zyz2020.getZyzAvgGrade().toString());
				}else{
					schoolRecord2020.setAvgGrade("-");
				}
				if(zyz2020.getZyzLowGrade()!=null){
					schoolRecord2020.setMinGrade(zyz2020.getZyzLowGrade().toString());
				}else{
					schoolRecord2020.setMinGrade("-");
				}
				if(zyz2020.getZyzLowPm()!=null){
					schoolRecord2020.setMinGradeSeq(zyz2020.getZyzLowPm().toString());
				}else{
					schoolRecord2020.setMinGradeSeq("-");
				}
				if(zyz2020.getZyzAvgPm()!=null){
					schoolRecord2020.setAvgGradeSeq(zyz2020.getZyzAvgPm().toString());
				}else{
					schoolRecord2020.setAvgGradeSeq("-");
				}
				String planSubmitAdmission="";
				if(zyz2020.getZyzPlan()!=null){
					schoolRecord2020.setPlan(zyz2020.getZyzPlan().toString());
					planSubmitAdmission=zyz2020.getZyzPlan().toString();
				}else{
					schoolRecord2020.setPlan("-");
				}
				if(zyz2020.getZyzAdmin()!=null){
					schoolRecord2020.setSubmit(zyz2020.getZyzAdmin().toString());
					planSubmitAdmission=planSubmitAdmission+"-"+zyz2020.getZyzAdmin().toString();
				}else{
					schoolRecord2020.setSubmit("-");
					if(zyz2020.getZyzPlan()!=null){
						planSubmitAdmission=planSubmitAdmission+"-";
					}
				}
				schoolRecord2020.setPlanSubmitAdmission(planSubmitAdmission);
			}else{
				schoolRecord2020.setAvgGrade("-");
				schoolRecord2020.setMinGrade("-");
				schoolRecord2020.setAvgGradeSeq("-");
				schoolRecord2020.setMinGradeSeq("-");
				schoolRecord2020.setPlan("-");
				schoolRecord2020.setSubmit("-");
				schoolRecord2020.setPlanSubmitAdmission("-");
			}

			/**
			 * 专业组投档概率
			 * (考生成绩-录取最低分)/2+50
			 * double finalRate = (memberGrade - grade) / 2 + 50;
			 */
			SchoolPlan lowGradePlan2024=null;
			for(int s=0;s<plans2024List.size();s++) {
				SchoolPlan plan2024 = plans2024List.get(s);



				//学校和专业组相等
				//System.out.println("------------plan2024.getSchoolCode()--------"+plan2024.getSchoolCode()+"------schoolRecord2022.getScode()-----------"+schoolRecord2022.getScode()+"-------plan2024.getZyz()---"+plan2024.getZyz()+"-----schoolRecord2022.getZyz()---"+schoolRecord2022.getZyz()+"--");
				if (plan2024.getSchoolCode().equals(schoolRecord2022.getScode())
						&& plan2024.getZyz().equals(schoolRecord2022.getZyz())) {
					lowGradePlan2024=plan2024;
					break;
				}
			}
			if(provinceName.equals("广西")) {
				int memberGrade=memberQuery.getGxgrade();
				if(lowGradePlan2024!=null){
					int grade=lowGradePlan2024.getGrade();
					//double finalRate = (memberGrade - grade) / 2 + 50;
					float cha= (float)(memberGrade - grade) / 2;
					if(cha>0) cha=cha+1;
					if(cha<0) cha=cha-1;
					double finalRate = cha + 50;

					if(finalRate>=100) finalRate=99.99;
					if(finalRate<1) finalRate=1;

					if(schoolRecord2022.getMinGrade()!=null&&!schoolRecord2022.getMinGrade().equals("-")
							&&schoolRecord2022.getAvgGrade()!=null&&!schoolRecord2022.getAvgGrade().equals("-")){
						schoolRecord2020.setSubmitRate(df.format(finalRate));
						schoolRecord2021.setSubmitRate(df.format(finalRate));
						schoolRecord2022.setSubmitRate(df.format(finalRate));
					}else{
						schoolRecord2020.setSubmitRate("-");
						schoolRecord2021.setSubmitRate("-");
						schoolRecord2022.setSubmitRate("-");
					}

				}else{
					schoolRecord2020.setSubmitRate("-");
					schoolRecord2021.setSubmitRate("-");
					schoolRecord2022.setSubmitRate("-");
				}
			}else{
				int memberGrade=memberQuery.getQggrade();

				if(lowGradePlan2024!=null){
					int grade=lowGradePlan2024.getGrade();
					//double finalRate = (memberGrade - grade) / 2 + 50;
					float cha= (float)(memberGrade - grade) / 2;
					if(cha>0) cha=cha+1;
					if(cha<0) cha=cha-1;
					double finalRate = cha + 50;

					if(finalRate>=100) finalRate=99.99;
					if(finalRate<1) finalRate=1;

					if(schoolRecord2022.getMinGrade()!=null&&!schoolRecord2022.getMinGrade().equals("-")
							&&schoolRecord2022.getAvgGrade()!=null&&!schoolRecord2022.getAvgGrade().equals("-")){
						schoolRecord2020.setSubmitRate(df.format(finalRate));
						schoolRecord2021.setSubmitRate(df.format(finalRate));
						schoolRecord2022.setSubmitRate(df.format(finalRate));
					}else{
						schoolRecord2020.setSubmitRate("-");
						schoolRecord2021.setSubmitRate("-");
						schoolRecord2022.setSubmitRate("-");
					}
				}else{
					schoolRecord2020.setSubmitRate("-");
					schoolRecord2021.setSubmitRate("-");
					schoolRecord2022.setSubmitRate("-");
				}
			}

			returnList.add(schoolRecord2022);
			returnList.add(schoolRecord2021);
			returnList.add(schoolRecord2020);
        		
        	map.put("returnList", returnList);


			//该专业组下各专业录取概率
			List<SchoolMajorYearAdmission> zyList =new ArrayList();

			for(int i=0;i<distinctMajorList.size();i++) {
				SchoolPlan major =distinctMajorList.get(i);
				String majorPm="-";
				String majorSeq="";


				int zyavgGrade2022=0;
				int zyminGrade2022=0;
				int zyavgGrade2021=0;
				int zyminGrade2021=0;
				int zyavgGrade2020=0;
				int zyminGrade2020=0;

				//考生近3年的广西排位
				int gxj2022=0;
				int gxj2021=0;
				int gxj2020=0;
				//考生近3年全国排位分
				int qgj2022=0;
				int qgj2021=0;
				int qgj2020=0;


				boolean year1Flag=false;
                boolean year2Flag=false;
                boolean year3Flag=false;

				SchoolMajorYearAdmission schoolMajorYearAdmission2022 =null;
                SchoolMajorYearAdmission schoolMajorYearAdmission2021 =null;
				SchoolMajorYearAdmission schoolMajorYearAdmission2020 =null;

				for (int k = 0; k < majorList.size(); k++) {
					SchoolPlan schoolPlan = majorList.get(k);
					if(major.getMajorCode().equals(schoolPlan.getMajorCode())) {
						if (schoolPlan.getYear().intValue() == yearNew1) {
							year1Flag=true;

							schoolMajorYearAdmission2022 = new SchoolMajorYearAdmission();
							schoolMajorYearAdmission2022.setYear(yearNew1);
							schoolMajorYearAdmission2022.setMajorCode(schoolPlan.getMajorCode());
							schoolMajorYearAdmission2022.setMajorSeq(major.getMajorSeq());
							schoolMajorYearAdmission2022.setMajor(schoolPlan.getMajorName());
							schoolMajorYearAdmission2022.setThisYearMajorPlan(major.getMajorPlan());
							if(major.getMajorPlan()!=null){
								schoolMajorYearAdmission2022.setThisYearMajorPlanStr(major.getMajorPlan().toString());
							}else{
								schoolMajorYearAdmission2022.setThisYearMajorPlanStr("-");
							}
							schoolMajorYearAdmission2022.setsCode(schoolPlan.getSchoolCode());
							schoolMajorYearAdmission2022.setZyz(schoolPlan.getZyz());
							schoolMajorYearAdmission2022.setMajorPm(major.getMajorPm());
							//System.out.println(schoolPlan.getMajorCode()+"------------22-----"+schoolPlan.getMajorPm());

                            if(major.getMajorPm()!=null&&!major.getMajorPm().equals("")){
								majorPm=major.getMajorPm();
							}


							//设置分数线
							if ("物理".equals(memberQuery.getSxkm())) {
								schoolMajorYearAdmission2022.setGradeLine(new Integer(gradeLineLg2022).toString());
							}
							if ("历史".equals(memberQuery.getSxkm())) {
								schoolMajorYearAdmission2022.setGradeLine(new Integer(gradeLineWs2022).toString());
							}

							/**
							 * 计算当年的排名和对应的分数
							 */
							if (provinceName.equals("广西")) {

								if (memberGradeList != null && memberGradeList.size() > 0) {
									for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
										BuzMemberGrade memberGrade = memberGradeList.get(k1);
										if (memberGrade.getYear().intValue() == yearNew1) {
											if (memberGrade.getPmGradeGx() != null) {
												schoolMajorYearAdmission2022.setSeqGrade(memberGrade.getPmGradeGx().toString());
												gxj2022=memberGrade.getPmGradeGx();
											} else {
												schoolMajorYearAdmission2022.setSeqGrade("-");
											}
										}
									}
								}

								if (memberQuery.getGradePmGx() != null) {
									schoolMajorYearAdmission2022.setSeq(memberQuery.getGradePmGx().toString());
								} else {
									schoolMajorYearAdmission2022.setSeq("-");
								}
							} else {

								if (memberGradeList != null && memberGradeList.size() > 0) {
									for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
										BuzMemberGrade memberGrade = memberGradeList.get(k1);
										if (memberGrade.getYear().intValue() == yearNew1) {
											if (memberGrade.getPmGradeGx() != null) {
												schoolMajorYearAdmission2022.setSeqGrade(memberGrade.getPmGrade().toString());
												qgj2022=memberGrade.getPmGrade();
											} else {
												schoolMajorYearAdmission2022.setSeqGrade("-");
											}
										}
									}
								}

								if (memberQuery.getGradePm() != null) {
									schoolMajorYearAdmission2022.setSeq(memberQuery.getGradePm().toString());
								} else {
									schoolMajorYearAdmission2022.setSeq("-");
								}

							}

							/**
							 * 计算平均分、平均分排名、最低分、最低分排名、招生计划数和录取数
							 */

							if (schoolPlan.getMajorAvgGrade() != null) {
								schoolMajorYearAdmission2022.setAvgGradeStr(schoolPlan.getMajorAvgGrade().toString());
								zyavgGrade2022=schoolPlan.getMajorAvgGrade();
							} else {
								schoolMajorYearAdmission2022.setAvgGradeStr("-");
							}
							if (schoolPlan.getMajorLowGrade() != null) {
								schoolMajorYearAdmission2022.setMinGradeStr(schoolPlan.getMajorLowGrade().toString());
								zyminGrade2022=schoolPlan.getMajorLowGrade();
							} else {
								schoolMajorYearAdmission2022.setMinGradeStr("-");
							}
							if (schoolPlan.getMajorLowPm() != null) {
								schoolMajorYearAdmission2022.setMinGradeSeq(schoolPlan.getMajorLowPm().toString());
							} else {
								schoolMajorYearAdmission2022.setMinGradeSeq("-");
							}
							if (schoolPlan.getMajorAvgPm() != null) {
								schoolMajorYearAdmission2022.setAvgGradeSeq(schoolPlan.getMajorAvgPm().toString());
							} else {
								schoolMajorYearAdmission2022.setAvgGradeSeq("-");
							}
							String planSubmitAdmission = "";
							if (schoolPlan.getMajorPlan() != null) {
								schoolMajorYearAdmission2022.setMajorPlan(schoolPlan.getMajorPlan());
								schoolMajorYearAdmission2022.setMajorPlanStr(schoolPlan.getMajorPlan().toString());
								planSubmitAdmission = schoolPlan.getMajorPlan().toString();
							} else {
								schoolMajorYearAdmission2022.setMajorPlan(null);
							}
							if (schoolPlan.getMajorAdmin() != null) {
								schoolMajorYearAdmission2022.setSubmit(schoolPlan.getMajorAdmin());
								schoolMajorYearAdmission2022.setAdmission(schoolPlan.getMajorAdmin());
								planSubmitAdmission = planSubmitAdmission + "-" + schoolPlan.getMajorAdmin().toString();
							} else {
								schoolMajorYearAdmission2022.setSubmit(null);
								schoolMajorYearAdmission2022.setAdmission(null);
								if (schoolPlan.getMajorPlan() != null) {
									planSubmitAdmission = planSubmitAdmission + "-";
								}
							}
							schoolMajorYearAdmission2022.setPlanSubmitAdmission(planSubmitAdmission);

						}


						if (schoolPlan.getYear().intValue() == yearNew2) {

							year2Flag=true;

							schoolMajorYearAdmission2021 = new SchoolMajorYearAdmission();
							schoolMajorYearAdmission2021.setYear(yearNew2);
							schoolMajorYearAdmission2021.setMajorCode(schoolPlan.getMajorCode());
							schoolMajorYearAdmission2021.setMajorSeq(major.getMajorSeq());
							schoolMajorYearAdmission2021.setMajor(schoolPlan.getMajorName());
							schoolMajorYearAdmission2021.setThisYearMajorPlan(major.getMajorPlan());
							if(major.getMajorPlan()!=null){
								schoolMajorYearAdmission2021.setThisYearMajorPlanStr(major.getMajorPlan().toString());
							}else{
								schoolMajorYearAdmission2021.setThisYearMajorPlanStr("-");
							}
							schoolMajorYearAdmission2021.setsCode(schoolPlan.getSchoolCode());
							schoolMajorYearAdmission2021.setZyz(schoolPlan.getZyz());
							schoolMajorYearAdmission2021.setMajorPm(major.getMajorPm());
							//System.out.println(schoolPlan.getMajorCode()+"------------21-----"+schoolPlan.getMajorPm());
							if(major.getMajorPm()!=null&&!major.getMajorPm().equals("")){
								majorPm=major.getMajorPm();
							}


							//设置分数线
							if ("物理".equals(memberQuery.getSxkm())) {
								schoolMajorYearAdmission2021.setGradeLine(new Integer(gradeLineLg2021).toString());
							}
							if ("历史".equals(memberQuery.getSxkm())) {
								schoolMajorYearAdmission2021.setGradeLine(new Integer(gradeLineWs2021).toString());
							}

							/**
							 * 计算当年的排名和对应的分数
							 */
							if (provinceName.equals("广西")) {

								if (memberGradeList != null && memberGradeList.size() > 0) {
									for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
										BuzMemberGrade memberGrade = memberGradeList.get(k1);
										if (memberGrade.getYear().intValue() == yearNew2) {
											if (memberGrade.getPmGradeGx() != null) {
												schoolMajorYearAdmission2021.setSeqGrade(memberGrade.getPmGradeGx().toString());
												gxj2021=memberGrade.getPmGradeGx();
											} else {
												schoolMajorYearAdmission2021.setSeqGrade("-");
											}
										}
									}
								}

								if (memberQuery.getGradePmGx() != null) {
									schoolMajorYearAdmission2021.setSeq(memberQuery.getGradePmGx().toString());
								} else {
									schoolMajorYearAdmission2021.setSeq("-");
								}
							} else {

								if (memberGradeList != null && memberGradeList.size() > 0) {
									for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
										BuzMemberGrade memberGrade = memberGradeList.get(k1);
										if (memberGrade.getYear().intValue() == yearNew2) {
											if (memberGrade.getPmGradeGx() != null) {
												schoolMajorYearAdmission2021.setSeqGrade(memberGrade.getPmGrade().toString());
												qgj2021=memberGrade.getPmGrade();
											} else {
												schoolMajorYearAdmission2021.setSeqGrade("-");
											}
										}
									}
								}

								if (memberQuery.getGradePm() != null) {
									schoolMajorYearAdmission2021.setSeq(memberQuery.getGradePm().toString());
								} else {
									schoolMajorYearAdmission2021.setSeq("-");
								}

							}


							if (schoolPlan.getMajorAvgGrade() != null) {
								schoolMajorYearAdmission2021.setAvgGradeStr(schoolPlan.getMajorAvgGrade().toString());
								zyavgGrade2021=schoolPlan.getMajorAvgGrade();
							} else {
								schoolMajorYearAdmission2021.setAvgGradeStr("-");
							}
							if (schoolPlan.getMajorLowGrade() != null) {
								schoolMajorYearAdmission2021.setMinGradeStr(schoolPlan.getMajorLowGrade().toString());
								zyminGrade2021=schoolPlan.getMajorLowGrade();
							} else {
								schoolMajorYearAdmission2021.setMinGradeStr("-");
							}
							if (schoolPlan.getMajorLowPm() != null) {
								schoolMajorYearAdmission2021.setMinGradeSeq(schoolPlan.getMajorLowPm().toString());
							} else {
								schoolMajorYearAdmission2021.setMinGradeSeq("-");
							}
							if (schoolPlan.getMajorAvgPm() != null) {
								schoolMajorYearAdmission2021.setAvgGradeSeq(schoolPlan.getMajorAvgPm().toString());
							} else {
								schoolMajorYearAdmission2021.setAvgGradeSeq("-");
							}
							String planSubmitAdmission = "";
							if (schoolPlan.getMajorPlan() != null) {
								schoolMajorYearAdmission2021.setMajorPlan(schoolPlan.getMajorPlan());
								schoolMajorYearAdmission2021.setMajorPlanStr(schoolPlan.getMajorPlan().toString());
								planSubmitAdmission = schoolPlan.getMajorPlan().toString();
							} else {
								schoolMajorYearAdmission2021.setMajorPlan(null);
							}
							if (schoolPlan.getMajorAdmin() != null) {
								schoolMajorYearAdmission2021.setSubmit(schoolPlan.getMajorAdmin());
								schoolMajorYearAdmission2021.setAdmission(schoolPlan.getMajorAdmin());
								planSubmitAdmission = planSubmitAdmission + "-" + schoolPlan.getMajorAdmin().toString();
							} else {
								schoolMajorYearAdmission2021.setSubmit(null);
								schoolMajorYearAdmission2021.setAdmission(null);
								if (schoolPlan.getMajorPlan() != null) {
									planSubmitAdmission = planSubmitAdmission + "-";
								}
							}
							schoolMajorYearAdmission2021.setPlanSubmitAdmission(planSubmitAdmission);


						}


						if (schoolPlan.getYear().intValue() == yearNew3) {

							year3Flag=true;

							schoolMajorYearAdmission2020 = new SchoolMajorYearAdmission();
							schoolMajorYearAdmission2020.setYear(yearNew3);
							schoolMajorYearAdmission2020.setMajorCode(schoolPlan.getMajorCode());
							schoolMajorYearAdmission2020.setMajorSeq(major.getMajorSeq());
							schoolMajorYearAdmission2020.setMajor(schoolPlan.getMajorName());
							schoolMajorYearAdmission2020.setThisYearMajorPlan(major.getMajorPlan());
							if(major.getMajorPlan()!=null){
								schoolMajorYearAdmission2020.setThisYearMajorPlanStr(major.getMajorPlan().toString());
							}else{
								schoolMajorYearAdmission2020.setThisYearMajorPlanStr("-");
							}
							schoolMajorYearAdmission2020.setsCode(schoolPlan.getSchoolCode());
							schoolMajorYearAdmission2020.setZyz(schoolPlan.getZyz());
							schoolMajorYearAdmission2020.setMajorPm(major.getMajorPm());
							//System.out.println(schoolPlan.getMajorCode()+"------------20-----"+schoolPlan.getMajorPm());
							if(major.getMajorPm()!=null&&!major.getMajorPm().equals("")){
								majorPm=major.getMajorPm();
							}


							//设置分数线
							if ("物理".equals(memberQuery.getSxkm())) {
								schoolMajorYearAdmission2020.setGradeLine(new Integer(gradeLineLg2020).toString());
							}
							if ("历史".equals(memberQuery.getSxkm())) {
								schoolMajorYearAdmission2020.setGradeLine(new Integer(gradeLineWs2020).toString());
							}

							/**
							 * 计算当年的排名和对应的分数
							 */
							if (provinceName.equals("广西")) {

								if (memberGradeList != null && memberGradeList.size() > 0) {
									for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
										BuzMemberGrade memberGrade = memberGradeList.get(k1);
										if (memberGrade.getYear().intValue() == yearNew3) {
											if (memberGrade.getPmGradeGx() != null) {
												schoolMajorYearAdmission2020.setSeqGrade(memberGrade.getPmGradeGx().toString());
												gxj2020=memberGrade.getPmGradeGx();
											} else {
												schoolMajorYearAdmission2020.setSeqGrade("-");
											}
										}
									}
								}

								if (memberQuery.getGradePmGx() != null) {
									schoolMajorYearAdmission2020.setSeq(memberQuery.getGradePmGx().toString());
								} else {
									schoolMajorYearAdmission2020.setSeq("-");
								}
							} else {

								if (memberGradeList != null && memberGradeList.size() > 0) {
									for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
										BuzMemberGrade memberGrade = memberGradeList.get(k1);
										if (memberGrade.getYear().intValue() == yearNew3) {
											if (memberGrade.getPmGradeGx() != null) {
												schoolMajorYearAdmission2020.setSeqGrade(memberGrade.getPmGrade().toString());
												qgj2020=memberGrade.getPmGrade();
											} else {
												schoolMajorYearAdmission2020.setSeqGrade("-");
											}
										}
									}
								}

								if (memberQuery.getGradePm() != null) {
									schoolMajorYearAdmission2020.setSeq(memberQuery.getGradePm().toString());
								} else {
									schoolMajorYearAdmission2020.setSeq("-");
								}

							}


							if (schoolPlan.getMajorAvgGrade() != null) {
								schoolMajorYearAdmission2020.setAvgGradeStr(schoolPlan.getMajorAvgGrade().toString());
								zyavgGrade2020=schoolPlan.getMajorAvgGrade();
							} else {
								schoolMajorYearAdmission2020.setAvgGradeStr("-");
							}
							if (schoolPlan.getMajorLowGrade() != null) {
								schoolMajorYearAdmission2020.setMinGradeStr(schoolPlan.getMajorLowGrade().toString());
								zyminGrade2020=schoolPlan.getMajorLowGrade();
							} else {
								schoolMajorYearAdmission2020.setMinGradeStr("-");
							}
							if (schoolPlan.getMajorLowPm() != null) {
								schoolMajorYearAdmission2020.setMinGradeSeq(schoolPlan.getMajorLowPm().toString());
							} else {
								schoolMajorYearAdmission2020.setMinGradeSeq("-");
							}
							if (schoolPlan.getMajorAvgPm() != null) {
								schoolMajorYearAdmission2020.setAvgGradeSeq(schoolPlan.getMajorAvgPm().toString());
							} else {
								schoolMajorYearAdmission2020.setAvgGradeSeq("-");
							}
							String planSubmitAdmission = "";
							if (schoolPlan.getMajorPlan() != null) {
								schoolMajorYearAdmission2020.setMajorPlan(schoolPlan.getMajorPlan());
								schoolMajorYearAdmission2020.setMajorPlanStr(schoolPlan.getMajorPlan().toString());
								planSubmitAdmission = schoolPlan.getMajorPlan().toString();
							} else {
								schoolMajorYearAdmission2020.setMajorPlan(null);
							}
							if (schoolPlan.getMajorAdmin() != null) {
								schoolMajorYearAdmission2020.setSubmit(schoolPlan.getMajorAdmin());
								schoolMajorYearAdmission2020.setAdmission(schoolPlan.getMajorAdmin());
								planSubmitAdmission = planSubmitAdmission + "-" + schoolPlan.getMajorAdmin().toString();
							} else {
								schoolMajorYearAdmission2020.setSubmit(null);
								schoolMajorYearAdmission2020.setAdmission(null);
								if (schoolPlan.getMajorPlan() != null) {
									planSubmitAdmission = planSubmitAdmission + "-";
								}
							}
							schoolMajorYearAdmission2020.setPlanSubmitAdmission(planSubmitAdmission);


						}//3个年份判断结束

					}//专业明细与专业循环是同一个专业
				}//专业明细循环，下面要开始判断一共添加了几个专业

				if(!year1Flag) {//第一个年份是空，需要添加空记录
					year1Flag=true;

					schoolMajorYearAdmission2022 = new SchoolMajorYearAdmission();
					schoolMajorYearAdmission2022.setYear(yearNew1);
					schoolMajorYearAdmission2022.setMajorCode(major.getMajorCode());
					schoolMajorYearAdmission2022.setMajorSeq(major.getMajorSeq());
					schoolMajorYearAdmission2022.setMajor(major.getMajorName());
					schoolMajorYearAdmission2022.setThisYearMajorPlan(major.getMajorPlan());
					if(major.getMajorPlan()!=null){
						schoolMajorYearAdmission2022.setThisYearMajorPlanStr(major.getMajorPlan().toString());
					}else{
						schoolMajorYearAdmission2022.setThisYearMajorPlanStr("-");
					}
					schoolMajorYearAdmission2022.setsCode(major.getSchoolCode());
					schoolMajorYearAdmission2022.setZyz(major.getZyz());
					schoolMajorYearAdmission2022.setMajorPm(major.getMajorPm());


					//设置分数线
					if ("物理".equals(memberQuery.getSxkm())) {
						schoolMajorYearAdmission2022.setGradeLine(new Integer(gradeLineLg2022).toString());
					}
					if ("历史".equals(memberQuery.getSxkm())) {
						schoolMajorYearAdmission2022.setGradeLine(new Integer(gradeLineWs2022).toString());
					}

					/**
					 * 计算当年的排名和对应的分数
					 */
					if (provinceName.equals("广西")) {

						if (memberGradeList != null && memberGradeList.size() > 0) {
							for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
								BuzMemberGrade memberGrade = memberGradeList.get(k1);
								if (memberGrade.getYear().intValue() == yearNew1) {
									if (memberGrade.getPmGradeGx() != null) {
										schoolMajorYearAdmission2022.setSeqGrade(memberGrade.getPmGradeGx().toString());
									} else {
										schoolMajorYearAdmission2022.setSeqGrade("-");
									}
								}
							}
						}

						if (memberQuery.getGradePmGx() != null) {
							schoolMajorYearAdmission2022.setSeq(memberQuery.getGradePmGx().toString());
						} else {
							schoolMajorYearAdmission2022.setSeq("-");
						}
					} else {

						if (memberGradeList != null && memberGradeList.size() > 0) {
							for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
								BuzMemberGrade memberGrade = memberGradeList.get(k1);
								if (memberGrade.getYear().intValue() == yearNew1) {
									if (memberGrade.getPmGradeGx() != null) {
										schoolMajorYearAdmission2022.setSeqGrade(memberGrade.getPmGrade().toString());
									} else {
										schoolMajorYearAdmission2022.setSeqGrade("-");
									}
								}
							}
						}

						if (memberQuery.getGradePm() != null) {
							schoolMajorYearAdmission2022.setSeq(memberQuery.getGradePm().toString());
						} else {
							schoolMajorYearAdmission2022.setSeq("-");
						}

					}

					schoolMajorYearAdmission2022.setAvgGradeStr("-");
					schoolMajorYearAdmission2022.setAvgGradeSeq("-");
					schoolMajorYearAdmission2022.setMinGradeStr("-");
					schoolMajorYearAdmission2022.setMinGradeSeq("-");
					schoolMajorYearAdmission2022.setMajorPlan(null);
					schoolMajorYearAdmission2022.setSubmit(null);
					schoolMajorYearAdmission2022.setPlanSubmitAdmission("-");

				}//补全第一个年份

				if(!year2Flag) {//第一个年份是空，需要添加空记录
					year2Flag=true;

					schoolMajorYearAdmission2021 = new SchoolMajorYearAdmission();
					schoolMajorYearAdmission2021.setYear(yearNew2);
					schoolMajorYearAdmission2021.setMajorCode(major.getMajorCode());
					schoolMajorYearAdmission2021.setMajorSeq(major.getMajorSeq());
					schoolMajorYearAdmission2021.setMajor(major.getMajorName());
					schoolMajorYearAdmission2021.setThisYearMajorPlan(major.getMajorPlan());
					if(major.getMajorPlan()!=null){
						schoolMajorYearAdmission2021.setThisYearMajorPlanStr(major.getMajorPlan().toString());
					}else{
						schoolMajorYearAdmission2021.setThisYearMajorPlanStr("-");
					}
					schoolMajorYearAdmission2021.setsCode(major.getSchoolCode());
					schoolMajorYearAdmission2021.setZyz(major.getZyz());
					schoolMajorYearAdmission2021.setMajorPm(major.getMajorPm());


					//设置分数线
					if ("物理".equals(memberQuery.getSxkm())) {
						schoolMajorYearAdmission2021.setGradeLine(new Integer(gradeLineLg2021).toString());
					}
					if ("历史".equals(memberQuery.getSxkm())) {
						schoolMajorYearAdmission2021.setGradeLine(new Integer(gradeLineWs2021).toString());
					}

					/**
					 * 计算当年的排名和对应的分数
					 */
					if (provinceName.equals("广西")) {

						if (memberGradeList != null && memberGradeList.size() > 0) {
							for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
								BuzMemberGrade memberGrade = memberGradeList.get(k1);
								if (memberGrade.getYear().intValue() == yearNew2) {
									if (memberGrade.getPmGradeGx() != null) {
										schoolMajorYearAdmission2021.setSeqGrade(memberGrade.getPmGradeGx().toString());
									} else {
										schoolMajorYearAdmission2021.setSeqGrade("-");
									}
								}
							}
						}

						if (memberQuery.getGradePmGx() != null) {
							schoolMajorYearAdmission2021.setSeq(memberQuery.getGradePmGx().toString());
						} else {
							schoolMajorYearAdmission2021.setSeq("-");
						}
					} else {

						if (memberGradeList != null && memberGradeList.size() > 0) {
							for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
								BuzMemberGrade memberGrade = memberGradeList.get(k1);
								if (memberGrade.getYear().intValue() == yearNew2) {
									if (memberGrade.getPmGradeGx() != null) {
										schoolMajorYearAdmission2021.setSeqGrade(memberGrade.getPmGrade().toString());
									} else {
										schoolMajorYearAdmission2021.setSeqGrade("-");
									}
								}
							}
						}

						if (memberQuery.getGradePm() != null) {
							schoolMajorYearAdmission2021.setSeq(memberQuery.getGradePm().toString());
						} else {
							schoolMajorYearAdmission2021.setSeq("-");
						}

					}

					schoolMajorYearAdmission2021.setAvgGradeStr("-");
					schoolMajorYearAdmission2021.setAvgGradeSeq("-");
					schoolMajorYearAdmission2021.setMinGradeStr("-");
					schoolMajorYearAdmission2021.setMinGradeSeq("-");
					schoolMajorYearAdmission2021.setMajorPlan(null);
					schoolMajorYearAdmission2021.setSubmit(null);
					schoolMajorYearAdmission2021.setPlanSubmitAdmission("-");

				}//补全第二个年份

				if(!year3Flag) {//第一个年份是空，需要添加空记录
					year3Flag=true;

					schoolMajorYearAdmission2020 = new SchoolMajorYearAdmission();
					schoolMajorYearAdmission2020.setYear(yearNew3);
					schoolMajorYearAdmission2020.setMajorCode(major.getMajorCode());
					schoolMajorYearAdmission2020.setMajorSeq(major.getMajorSeq());
					schoolMajorYearAdmission2020.setMajor(major.getMajorName());
					schoolMajorYearAdmission2020.setThisYearMajorPlan(major.getMajorPlan());
					if(major.getMajorPlan()!=null){
						schoolMajorYearAdmission2020.setThisYearMajorPlanStr(major.getMajorPlan().toString());
					}else{
						schoolMajorYearAdmission2020.setThisYearMajorPlanStr("-");
					}
					schoolMajorYearAdmission2020.setsCode(major.getSchoolCode());
					schoolMajorYearAdmission2020.setZyz(major.getZyz());
					schoolMajorYearAdmission2020.setMajorPm(major.getMajorPm());


					//设置分数线
					if ("物理".equals(memberQuery.getSxkm())) {
						schoolMajorYearAdmission2020.setGradeLine(new Integer(gradeLineLg2020).toString());
					}
					if ("历史".equals(memberQuery.getSxkm())) {
						schoolMajorYearAdmission2020.setGradeLine(new Integer(gradeLineWs2020).toString());
					}

					/**
					 * 计算当年的排名和对应的分数
					 */
					if (provinceName.equals("广西")) {

						if (memberGradeList != null && memberGradeList.size() > 0) {
							for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
								BuzMemberGrade memberGrade = memberGradeList.get(k1);
								if (memberGrade.getYear().intValue() == yearNew3) {
									if (memberGrade.getPmGradeGx() != null) {
										schoolMajorYearAdmission2020.setSeqGrade(memberGrade.getPmGradeGx().toString());
									} else {
										schoolMajorYearAdmission2020.setSeqGrade("-");
									}
								}
							}
						}

						if (memberQuery.getGradePmGx() != null) {
							schoolMajorYearAdmission2020.setSeq(memberQuery.getGradePmGx().toString());
						} else {
							schoolMajorYearAdmission2020.setSeq("-");
						}
					} else {

						if (memberGradeList != null && memberGradeList.size() > 0) {
							for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
								BuzMemberGrade memberGrade = memberGradeList.get(k1);
								if (memberGrade.getYear().intValue() == yearNew3) {
									if (memberGrade.getPmGradeGx() != null) {
										schoolMajorYearAdmission2020.setSeqGrade(memberGrade.getPmGrade().toString());
									} else {
										schoolMajorYearAdmission2020.setSeqGrade("-");
									}
								}
							}
						}

						if (memberQuery.getGradePm() != null) {
							schoolMajorYearAdmission2020.setSeq(memberQuery.getGradePm().toString());
						} else {
							schoolMajorYearAdmission2020.setSeq("-");
						}

					}

					schoolMajorYearAdmission2020.setAvgGradeStr("-");
					schoolMajorYearAdmission2020.setAvgGradeSeq("-");
					schoolMajorYearAdmission2020.setMinGradeStr("-");
					schoolMajorYearAdmission2020.setMinGradeSeq("-");
					schoolMajorYearAdmission2020.setMajorPlan(null);
					schoolMajorYearAdmission2020.setSubmit(null);
					schoolMajorYearAdmission2020.setPlanSubmitAdmission("-");

				}//补全第三个年份


				/**
				 * 计算专业组投档概率
				 *
				 * 1、当年的排位分-该专业的平均分
				 */

				/**
				 * 院校专业组投档及专业录取概率：以2024年的分数直接和院校专业组或专业录取最低分的比较。等于的为50%，以两分为1%来算，比如考生的分数为500，这个院校专业组的投档线是500，那么这个院校专业组的投档概率为50%，如果是498，或499的分数，投档概率为49%，501,502分的为51%，以此类推，最高投档概率为99.9%，最低为1%。
				 */

				if(provinceName.equals("广西")) {
					int memberGxGrade=memberQuery.getGxgrade();
					int yearLowGrade=0;
					if(schoolMajorYearAdmission2022!=null&&schoolMajorYearAdmission2022.getMinGradeStr()!=null
							&&!schoolMajorYearAdmission2022.getMinGradeStr().equals("-")&&!schoolMajorYearAdmission2022.getMinGradeStr().equals("")){
						yearLowGrade=new Integer(schoolMajorYearAdmission2022.getMinGradeStr());
					}

					if(yearLowGrade==0){
						if(schoolMajorYearAdmission2021!=null&&schoolMajorYearAdmission2021.getMinGradeStr()!=null
								&&!schoolMajorYearAdmission2021.getMinGradeStr().equals("-")&&!schoolMajorYearAdmission2021.getMinGradeStr().equals("")){
							yearLowGrade = new Integer(schoolMajorYearAdmission2021.getMinGradeStr());
						}
					}
					if(yearLowGrade==0){
						if(schoolMajorYearAdmission2020!=null&&schoolMajorYearAdmission2020.getMinGradeStr()!=null
								&&!schoolMajorYearAdmission2020.getMinGradeStr().equals("-")&&!schoolMajorYearAdmission2020.getMinGradeStr().equals("")){
							yearLowGrade = new Integer(schoolMajorYearAdmission2020.getMinGradeStr());
						}
					}
					if(yearLowGrade==0){
						schoolMajorYearAdmission2020.setSubmitRate("-");
						schoolMajorYearAdmission2021.setSubmitRate("-");
						schoolMajorYearAdmission2022.setSubmitRate("-");
					}else {
						if (memberGxGrade == yearLowGrade) {
							schoolMajorYearAdmission2020.setSubmitRate("50");
							schoolMajorYearAdmission2021.setSubmitRate("50");
							schoolMajorYearAdmission2022.setSubmitRate("50");
						} else {
							float cha = (float) (memberGxGrade - yearLowGrade) / 2;
							if (cha < 0) {
								cha = cha - 1 + 50;
							} else {
								cha = cha + 1 + 50;
							}
							if (cha >= 100) cha = 99.99f;
							if (cha < 1) cha = 1;
							schoolMajorYearAdmission2020.setSubmitRate(df.format(cha));
							schoolMajorYearAdmission2021.setSubmitRate(df.format(cha));
							schoolMajorYearAdmission2022.setSubmitRate(df.format(cha));
						}
					}
				}else{
					int memberGxGrade=memberQuery.getQggrade();
					int yearLowGrade=0;
					if(schoolMajorYearAdmission2022!=null&&schoolMajorYearAdmission2022.getMinGradeStr()!=null
							&&!schoolMajorYearAdmission2022.getMinGradeStr().equals("-")&&!schoolMajorYearAdmission2022.getMinGradeStr().equals("")){
						yearLowGrade=new Integer(schoolMajorYearAdmission2022.getMinGradeStr());
					}

					if(yearLowGrade==0){
						if(schoolMajorYearAdmission2021!=null&&schoolMajorYearAdmission2021.getMinGradeStr()!=null
								&&!schoolMajorYearAdmission2021.getMinGradeStr().equals("-")&&!schoolMajorYearAdmission2021.getMinGradeStr().equals("")){
							yearLowGrade = new Integer(schoolMajorYearAdmission2021.getMinGradeStr());
						}
					}
					if(yearLowGrade==0){
						if(schoolMajorYearAdmission2020!=null&&schoolMajorYearAdmission2020.getMinGradeStr()!=null
								&&!schoolMajorYearAdmission2020.getMinGradeStr().equals("-")&&!schoolMajorYearAdmission2020.getMinGradeStr().equals("")){
							yearLowGrade = new Integer(schoolMajorYearAdmission2020.getMinGradeStr());
						}
					}
					if(yearLowGrade==0){
						schoolMajorYearAdmission2020.setSubmitRate("-");
						schoolMajorYearAdmission2021.setSubmitRate("-");
						schoolMajorYearAdmission2022.setSubmitRate("-");
					}else {
						if (memberGxGrade == yearLowGrade) {
							schoolMajorYearAdmission2020.setSubmitRate("50");
							schoolMajorYearAdmission2021.setSubmitRate("50");
							schoolMajorYearAdmission2022.setSubmitRate("50");
						} else {
							float cha = (float) (memberGxGrade - yearLowGrade) / 2;
							if (cha < 0) {
								cha = cha - 1 + 50;
							} else {
								cha = cha + 1 + 50;
							}
							if (cha >= 100) cha = 99.99f;
							if (cha < 1) cha = 1;
							schoolMajorYearAdmission2020.setSubmitRate(df.format(cha));
							schoolMajorYearAdmission2021.setSubmitRate(df.format(cha));
							schoolMajorYearAdmission2022.setSubmitRate(df.format(cha));
						}
					}
				}

				/*

				if(zyavgGrade2020>0&&zyavgGrade2021>0&&zyavgGrade2022>0) {//3年都有数据
					if(provinceName.equals("广西")) {

						int memberGxGrade=memberQuery.getGxgrade();


						if(gxj2020-zyavgGrade2020>0 &&gxj2021-zyavgGrade2021>0 &&gxj2022-zyavgGrade2022>0) {//3年的同位分都比录取平均分高
							double rate=((gxj2022-zyavgGrade2022)/2+80)*0.55+((gxj2021-zyavgGrade2021)/2+80)*0.3+((gxj2020-zyavgGrade2020)/2+80)*0.15;

							if(rate>=100) rate=99.99;
							if(rate<1) rate=1;
							schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
							schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
							schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
						}else {
							double rate=0;
							//2年高于
							int count=0;
							if(gxj2022-zyavgGrade2022>0) {
								count++;
							}
							if(gxj2021-zyavgGrade2021>0) {
								count++;
							}
							if(gxj2020-zyavgGrade2020>0) {
								count++;
							}
							if(count==2) {//有2年高于同位分的

								if(gxj2022-zyavgGrade2022>0) {
									rate=rate+((gxj2022-zyavgGrade2022)/2+70)*0.55;
								}else {
									rate=rate+((gxj2022-zyminGrade2022)/2+50)*0.55;
								}

								if(gxj2021-zyavgGrade2021>0) {
									rate=rate+((gxj2021-zyavgGrade2021)/2+70)*0.3;
								}else {
									rate=rate+((gxj2021-zyminGrade2021)/2+50)*0.3;
								}

								if(gxj2020-zyavgGrade2020>0) {
									rate=rate+((gxj2020-zyavgGrade2020)/2+70)*0.15;
								}else {
									rate=rate+((gxj2020-zyminGrade2020)/2+50)*0.15;
								}
							}else if(count==1) {//有1年高于同位分的

								if(gxj2022-zyavgGrade2022>0) {
									rate=rate+((gxj2022-zyavgGrade2022)/2+60)*0.55;
								}else {
									rate=rate+((gxj2022-zyminGrade2022)/2+50)*0.55;
								}

								if(gxj2021-zyavgGrade2021>0) {
									rate=rate+((gxj2021-zyavgGrade2021)/2+60)*0.3;
								}else {
									rate=rate+((gxj2021-zyminGrade2021)/2+50)*0.3;
								}

								if(gxj2020-zyavgGrade2020>0) {
									rate=rate+((gxj2020-zyavgGrade2020)/2+60)*0.15;
								}else {
									rate=rate+((gxj2020-zyminGrade2020)/2+50)*0.15;
								}

							}else {//一个高于的都没有
								rate=((gxj2022-zyminGrade2022)/2+50)*0.55+((gxj2021-zyminGrade2021)/2+50)*0.3+((gxj2020-zyminGrade2020)/2+50)*0.15;
							}

							if(rate>=100) rate=99.99;
							if(rate<1) rate=1;
							schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
							schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
							schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
						}
					}else {//全国学校，用全国同位分
						if(qgj2020-zyavgGrade2020>0 &&qgj2021-zyavgGrade2021>0 &&qgj2022-zyavgGrade2022>0) {//3年的同位分都比录取平均分高
							double rate=((qgj2022-zyavgGrade2022)/2+80)*0.55+((qgj2021-zyavgGrade2021)/2+80)*0.3+((qgj2020-zyavgGrade2020)/2+80)*0.15;

							if(rate>=100) rate=99.99;
							if(rate<1) rate=1;
							schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
							schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
							schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
						}else {
							double rate=0;
							//2年高于
							int count=0;
							if(qgj2022-zyavgGrade2022>0) {
								count++;
							}
							if(qgj2021-zyavgGrade2021>0) {
								count++;
							}
							if(qgj2020-zyavgGrade2020>0) {
								count++;
							}
							if(count==2) {//有2年高于同位分的

								if(qgj2022-zyavgGrade2022>0) {
									rate=rate+((qgj2022-zyavgGrade2022)/2+70)*0.55;
								}else {
									rate=rate+((qgj2022-zyminGrade2022)/2+50)*0.55;
								}

								if(qgj2021-zyavgGrade2021>0) {
									rate=rate+((qgj2021-zyavgGrade2021)/2+70)*0.3;
								}else {
									rate=rate+((qgj2021-zyminGrade2021)/2+50)*0.3;
								}

								if(qgj2020-zyavgGrade2020>0) {
									rate=rate+((qgj2020-zyavgGrade2020)/2+70)*0.15;
								}else {
									rate=rate+((qgj2020-zyminGrade2020)/2+50)*0.15;
								}
							}else if(count==1) {//有1年高于同位分的

								if(qgj2022-zyavgGrade2022>0) {
									rate=rate+((qgj2022-zyavgGrade2022)/2+60)*0.55;
								}else {
									rate=rate+((qgj2022-zyminGrade2022)/2+50)*0.55;
								}

								if(qgj2021-zyavgGrade2021>0) {
									rate=rate+((qgj2021-zyavgGrade2021)/2+60)*0.3;
								}else {
									rate=rate+((qgj2021-zyminGrade2021)/2+50)*0.3;
								}

								if(qgj2020-zyavgGrade2020>0) {
									rate=rate+((qgj2020-zyavgGrade2020)/2+60)*0.15;
								}else {
									rate=rate+((qgj2020-zyminGrade2020)/2+50)*0.15;
								}

							}else {//一个高于的都没有
								rate=((qgj2022-zyminGrade2022)/2+50)*0.55+((qgj2021-zyminGrade2021)/2+50)*0.3+((qgj2020-zyminGrade2020)/2+50)*0.15;
							}


							if(rate>=100) rate=99.99;
							if(rate<1) rate=1;
							schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
							schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
							schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
						}
					}
				}else {//数据不满3年
					int years=0;
					if(zyavgGrade2020>0) years++;
					if(zyavgGrade2021>0) years++;
					if(zyavgGrade2022>0) years++;
					if(years==2) {
						double rate=0;
						if(provinceName.equals("广西")) {
							int heightYears=0;//这两年中，同位分大于平均分的年份数=2，则+70，如果年份数=1，则+60，都不大于平均分，则+50
							if(zyavgGrade2022>0&&gxj2022-zyavgGrade2022>0) heightYears++;
							if(zyavgGrade2021>0&&gxj2021-zyavgGrade2021>0) heightYears++;
							if(zyavgGrade2020>0&&gxj2020-zyavgGrade2020>0) heightYears++;

							if(zyavgGrade2022>0) {//2022年有数据
								if(heightYears==2) {
									double rate1=((gxj2022-zyavgGrade2022)/2+70)*0.60;
									rate=rate+rate1;

									if(zyavgGrade2021>0) {
										double rate2=((gxj2021-zyavgGrade2021)/2+70)*0.40;
										rate=rate+rate2;
									}else {
										double rate2=((gxj2020-zyavgGrade2020)/2+70)*0.40;
										rate=rate+rate2;
									}
								}else if(heightYears==1) {
									if(gxj2022-zyavgGrade2022>0) {
										double rate1=((gxj2022-zyavgGrade2022)/2+60)*0.60;
										rate=rate+rate1;
									}else {
										double rate1=((gxj2022-zyminGrade2022)/2+50)*0.60;
										rate=rate+rate1;
									}
									if(zyavgGrade2021>0) {
										if(gxj2021-zyavgGrade2021>0) {
											double rate1=((gxj2021-zyavgGrade2021)/2+60)*0.40;
											rate=rate+rate1;
										}else {
											double rate1=((gxj2021-zyminGrade2021)/2+60)*0.40;
											rate=rate+rate1;
										}
									}else {
										if(gxj2020-zyavgGrade2020>0) {
											double rate1=((gxj2020-zyavgGrade2020)/2+60)*0.40;
											rate=rate+rate1;
										}else {
											double rate1=((gxj2020-zyminGrade2020)/2+60)*0.40;
											rate=rate+rate1;
										}
									}
								}else {//都不高于平均分
									double rate1=((gxj2022-zyminGrade2022)/2+50)*0.60;
									rate=rate+rate1;
									if(zyavgGrade2021>0) {
										double rate2=((gxj2021-zyminGrade2021)/2+50)*0.60;
										rate=rate+rate2;
									}else {
										double rate2=((gxj2020-zyminGrade2020)/2+50)*0.40;
										rate=rate+rate2;
									}
								}
							}else {//2022年没数据，只有2021和2020年数据
								if(heightYears==2) {
									double rate1=((gxj2021-zyavgGrade2021)/2+70)*0.60+((gxj2020-zyavgGrade2020)/2+70)*0.40;
									rate=rate+rate1;
								}else if(heightYears==1) {
									if(gxj2021-zyavgGrade2021>0) {
										double rate1=((gxj2021-zyavgGrade2021)/2+60)*0.60;
										rate=rate+rate1;
									}else {
										double rate1=((gxj2021-zyminGrade2021)/2+50)*0.60;
										rate=rate+rate1;
									}
									if(gxj2020-zyavgGrade2020>0) {
										double rate1=((gxj2020-zyavgGrade2020)/2+60)*0.40;
										rate=rate+rate1;
									}else {
										double rate1=((gxj2020-zyminGrade2020)/2+50)*0.40;
										rate=rate+rate1;
									}
								}else {
									double rate1=((gxj2021-zyminGrade2021)/2+50)*0.60;
									rate=rate+rate1;

									double rate2=((gxj2020-zyminGrade2020)/2+50)*0.40;
									rate=rate+rate2;
								}
							}
						}else {//只有2年数据，全国的
							int heightYears=0;//这两年中，同位分大于平均分的年份数=2，则+70，如果年份数=1，则+60，都不大于平均分，则+50
							if(zyavgGrade2022>0&&qgj2022-zyavgGrade2022>0) heightYears++;
							if(zyavgGrade2021>0&&qgj2021-zyavgGrade2021>0) heightYears++;
							if(zyavgGrade2020>0&&qgj2020-zyavgGrade2020>0) heightYears++;

							if(zyavgGrade2022>0) {//2022年有数据
								if(heightYears==2) {
									double rate1=((qgj2022-zyavgGrade2022)/2+70)*0.60;
									rate=rate+rate1;

									if(zyavgGrade2021>0) {
										double rate2=((qgj2021-zyavgGrade2021)/2+70)*0.40;
										rate=rate+rate2;
									}else {
										double rate2=((qgj2020-zyavgGrade2020)/2+70)*0.40;
										rate=rate+rate2;
									}
								}else if(heightYears==1) {
									if(qgj2022-zyavgGrade2022>0) {
										double rate1=((qgj2022-zyavgGrade2022)/2+60)*0.60;
										rate=rate+rate1;
									}else {
										double rate1=((qgj2022-zyminGrade2022)/2+50)*0.60;
										rate=rate+rate1;
									}
									if(zyavgGrade2021>0) {
										if(qgj2021-zyavgGrade2021>0) {
											double rate1=((qgj2021-zyavgGrade2021)/2+60)*0.40;
											rate=rate+rate1;
										}else {
											double rate1=((qgj2021-zyminGrade2021)/2+60)*0.40;
											rate=rate+rate1;
										}
									}else {
										if(qgj2020-zyavgGrade2020>0) {
											double rate1=((qgj2020-zyavgGrade2020)/2+60)*0.40;
											rate=rate+rate1;
										}else {
											double rate1=((qgj2020-zyminGrade2020)/2+60)*0.40;
											rate=rate+rate1;
										}
									}
								}else {//都不高于平均分
									double rate1=((qgj2022-zyminGrade2022)/2+50)*0.60;
									rate=rate+rate1;
									if(zyavgGrade2021>0) {
										double rate2=((qgj2021-zyminGrade2021)/2+50)*0.60;
										rate=rate+rate2;
									}else {
										double rate2=((qgj2020-zyminGrade2020)/2+50)*0.40;
										rate=rate+rate2;
									}
								}
							}else {//2022年没数据，只有2021和2020年数据
								if(heightYears==2) {
									double rate1=((qgj2021-zyavgGrade2021)/2+70)*0.60+((qgj2020-zyavgGrade2020)/2+70)*0.40;
									rate=rate+rate1;
								}else if(heightYears==1) {
									if(qgj2021-zyavgGrade2021>0) {
										double rate1=((qgj2021-zyavgGrade2021)/2+60)*0.60;
										rate=rate+rate1;
									}else {
										double rate1=((qgj2021-zyminGrade2021)/2+50)*0.60;
										rate=rate+rate1;
									}
									if(qgj2020-zyavgGrade2020>0) {
										double rate1=((qgj2020-zyavgGrade2020)/2+60)*0.40;
										rate=rate+rate1;
									}else {
										double rate1=((qgj2020-zyminGrade2020)/2+50)*0.40;
										rate=rate+rate1;
									}
								}else {
									double rate1=((qgj2021-zyminGrade2021)/2+50)*0.60;
									rate=rate+rate1;

									double rate2=((qgj2020-zyminGrade2020)/2+50)*0.40;
									rate=rate+rate2;
								}
							}

						}

						if(rate>=100) rate=99.99;
						if(rate<1) rate=1;
						schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
						schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
						schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
					}else {//只有一年数据
						if(provinceName.equals("广西")) {

							if(zyavgGrade2022>0) {
								double rate=((gxj2022-zyminGrade2022)/2)+50;

								if(rate>=100) rate=99.99;
								if(rate<1) rate=1;
								schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
								schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
								schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
							}
							if(zyavgGrade2021>0) {
								double rate=((gxj2021-zyminGrade2021)/2)+50;

								if(rate>=100) rate=99.99;
								if(rate<1) rate=1;
								schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
								schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
								schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
							}
							if(zyavgGrade2020>0) {
								double rate=((gxj2020-zyminGrade2020)/2)+50;

								if(rate>=100) rate=99.99;
								if(rate<1) rate=1;
								schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
								schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
								schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
							}
						}else {//全国只有一年数据
							if(zyavgGrade2022>0) {
								double rate=((qgj2022-zyminGrade2022)/2)+50;

								if(rate>=100) rate=99.99;
								if(rate<1) rate=1;
								schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
								schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
								schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
							}
							if(zyavgGrade2021>0) {
								double rate=((qgj2021-zyminGrade2021)/2)+50;

								if(rate>=100) rate=99.99;
								if(rate<1) rate=1;
								schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
								schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
								schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
							}
							if(zyavgGrade2020>0) {
								double rate=((qgj2020-zyminGrade2020)/2)+50;

								if(rate>=100) rate=99.99;
								if(rate<1) rate=1;
								schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
								schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
								schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
							}
						}
					}
				}

				 */

/*
					专业的录取概率:(拿考生成绩-2024年专业的录取最低分）/2
					如果结果是正数，加1，如果结果是负数-1,
					然后再加50
					 */
				/*
				for(int s=0;s<plans2024List.size();s++){
					SchoolPlan plan2024= plans2024List.get(s);
					//学校和专业组相等
					if(plan2024.getSchoolCode().equals(schoolMajorYearAdmission2022.getsCode())
							&&plan2024.getZyz().equals(schoolMajorYearAdmission2022.getZyz())){
						//最低录取分数线
						int grade=plan2024.getGrade();
						int memberGrade=memberQuery.getGrade();
						if(schoolMajorYearAdmission2022.getSubmitRate()!=null) {
							double rate=new Double(schoolMajorYearAdmission2022.getSubmitRate());
							//((考生成绩-录取最低分)/2+50)*0.8+schoolRecord2022.getSubmitRate()*0.2
							//double finalRate = ((memberGrade - grade) / 2 + 50) * 0.8 + rate * 0.2;
							float cha= (float)(memberGrade - grade) / 2;
							if(cha>0) cha=cha+1;
							if(cha<0) cha=cha-1;
							double finalRate = cha + 50;

							if(finalRate>=100) finalRate=99.99;
							if(finalRate<1) finalRate=1;
							schoolMajorYearAdmission2022.setSubmitRate(df.format(finalRate));
							schoolMajorYearAdmission2022.setSubmitRate(df.format(finalRate));
							schoolMajorYearAdmission2022.setSubmitRate(df.format(finalRate));
						}

					}
				}

				 */

				if(schoolMajorYearAdmission2022.getSubmitRate()==null) {
					schoolMajorYearAdmission2022.setSubmitRate("-");
				}

				if(schoolMajorYearAdmission2022.getPlanSubmitAdmission()==null) {
					schoolMajorYearAdmission2022.setPlanSubmitAdmission("-");
				}

				schoolMajorYearAdmission2022.setMajorPm(majorPm);
				schoolMajorYearAdmission2021.setMajorPm(majorPm);
				schoolMajorYearAdmission2020.setMajorPm(majorPm);

				if(schoolMajorYearAdmission2022.getAvgGradeSeq()==null||schoolMajorYearAdmission2022.getAvgGradeSeq().equals("99999999")) {
					schoolMajorYearAdmission2022.setAvgGradeSeq("-");
				}

				if(schoolMajorYearAdmission2022.getMinGradeSeq()==null||schoolMajorYearAdmission2022.getMinGradeSeq().equals("99999999")) {
					schoolMajorYearAdmission2022.setMinGradeSeq("-");
				}

				if(schoolMajorYearAdmission2021.getSubmitRate()==null) {
					schoolMajorYearAdmission2021.setSubmitRate("-");

				}
				if(schoolMajorYearAdmission2021.getPlanSubmitAdmission()==null) {
					schoolMajorYearAdmission2021.setPlanSubmitAdmission("-");
				}


				if(schoolMajorYearAdmission2021.getAvgGradeSeq()==null||schoolMajorYearAdmission2021.getAvgGradeSeq().equals("99999999")) {
					schoolMajorYearAdmission2021.setAvgGradeSeq("-");
				}

				if(schoolMajorYearAdmission2021.getMinGradeSeq()==null||schoolMajorYearAdmission2021.getMinGradeSeq().equals("99999999")) {
					schoolMajorYearAdmission2021.setMinGradeSeq("-");
				}

				if(schoolMajorYearAdmission2020.getSubmitRate()==null) {
					schoolMajorYearAdmission2020.setSubmitRate("-");
				}
				if(schoolMajorYearAdmission2020.getPlanSubmitAdmission()==null) {
					schoolMajorYearAdmission2020.setPlanSubmitAdmission("-");
				}

				if(schoolMajorYearAdmission2022.getMajorPlan()==null) {
					schoolMajorYearAdmission2022.setMajorPlan(9999);
					schoolMajorYearAdmission2022.setMajorPlanStr("-");
				}else{
					schoolMajorYearAdmission2022.setMajorPlanStr(schoolMajorYearAdmission2022.getMajorPlan().toString());
				}

				if(schoolMajorYearAdmission2021.getMajorPlan()==null) {
					schoolMajorYearAdmission2021.setMajorPlan(9999);
					schoolMajorYearAdmission2021.setMajorPlanStr("-");
				}else{
					schoolMajorYearAdmission2021.setMajorPlanStr(schoolMajorYearAdmission2021.getMajorPlan().toString());
				}

				if(schoolMajorYearAdmission2020.getMajorPlan()==null) {
					schoolMajorYearAdmission2020.setMajorPlan(9999);
					schoolMajorYearAdmission2020.setMajorPlanStr("-");
				}else{
					schoolMajorYearAdmission2020.setMajorPlanStr(schoolMajorYearAdmission2020.getMajorPlan().toString());
				}

				if(schoolMajorYearAdmission2020.getAvgGradeSeq()==null||schoolMajorYearAdmission2020.getAvgGradeSeq().equals("99999999")) {
					schoolMajorYearAdmission2020.setAvgGradeSeq("-");
				}

				if(schoolMajorYearAdmission2020.getMinGradeSeq()==null||schoolMajorYearAdmission2020.getMinGradeSeq().equals("99999999")) {
					schoolMajorYearAdmission2020.setMinGradeSeq("-");
				}

				zyList.add(schoolMajorYearAdmission2022);
				zyList.add(schoolMajorYearAdmission2021);
				zyList.add(schoolMajorYearAdmission2020);

				map.put("zyList", zyList);


			}//专业循环
    				
    				

    				
    				//开始计算投档概率
    				/*
    				 * 
    				 * 
    				 * 
    				 *  专业投档概率计算
                  如果2023年招生人数<2022年招生人数，则(((2022年同位分-（2023年人数）的名次录取分))/2+50%)*55%   否则如果2023年招生人数>2022年招生人数,则((2022年同位分-（2022录取人数的最后一名的录取分)/2+50%)*55%，
                  如果2023年招生人数<2021年招生人数，则(2021年同位分-（2023年人数）的名次录取分))/2+50%)*30%+  否则如果2023年招生人数>2021年招生人数,则((2021年同位分-（2021录取人数的最后一名的录取分)/2+50%)*30%，
                  如果2023年招生人数<2020年招生人数，则(2020年同位分-（2023年人数）的名次录取分))/2+50%)*15%+  否则如果2023年招生人数>2020年招生人数,则((2020年同位分-（2020录取人数的最后一名的录取分)/2+50%)*15%，   

    				 * 
    				 * 招生数量对比占的概率
    				 * 1.当年招生数量，H是当年的招生数量，I是去年的招生数量
    				 * H＜=20，（H-I）%=h
                       20＜=H＜50,（H-I）×0.5%=h。
                       50＜H＜100,（H-I）×0.3%=h。
                       100＜H,（H-I）×0.1%=h。
                      
                      //目前的数据，投档数都是0，所以下面的内容暂时不算了 
                      2. I是去年的招生数量，L是去年的专业投档数 ；J是前年的招生数量，M是前年的专业投档数；K是大前年的招生数量，N是大前年的专业投档数
                      I-L为正数，增加5%概率，以i代替。
                      J-M为正数，增加5%概率，以j代替。
                      K-N为正数，增加5%概率，以k代替。
                       
    				 */
    				
    				
    				/*
    				int year2022Grade=0;//当年录取名次上一个名次对应的分数
    				int year2021Grade=0;//当年录取名次上一个名次对应的分数
    				int year2020Grade=0;//当年录取名次上一个名次对应的分数
    				int admissionYears=0; //录取情况数，有3年录取情况的，按55%，30%，15%比例分派。有2年录取数据的，按60%，40%比例分派，只有1年数据的按100%
    				
    				//当年同位分-名次分的大小，3年高于+80%，2年高于+70,1年高于+60，都没有高于+50
    				int heighPlan=0;
    				

    				*/
        	
        }
		map.put("member", memberQuery);
    	
    	return AjaxResult.success(map);
    }
    
    
    /************
     * 
     * @param schoolCode
     * @param fxTypes
     * @param userId
     * @return
     * 返回内容为：
     * 1个school对象
     * 1个专业组数组
     * 第一个专业组的投档概率（3条记录）
     * 第一个专业组下个专业的投档概率（每个专业3条记录）
     */
    @ApiOperation("专科综合分析详情")
    @GetMapping("/zhfx_detail_zk")
    public AjaxResult zhfx_detail_zk(String schoolCode,String fxTypes,String userId)
    {
    	
    	if(userId==null||userId.equals("")) {
    		return AjaxResult.error("请先登录");
    	}
    	
    	if(isSpecialChar(userId.toString())||sqlValidate(userId.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	BuzMember memberQuery=buzMemberService.selectBuzMemberById(userId);

    	if(memberQuery!=null&&memberQuery.getPhone()!=null) {
    		
    	}else {
    		
    		return AjaxResult.error("会员信息不存在，请先注册成为会员");
    	}
    	
    	if(memberQuery.getSfvip().intValue()==0) {
        	return AjaxResult.error("系统已更新，非会员不能查询");
        }
    	
    	if(schoolCode==null||schoolCode.trim().equals("")) {
    		
    		return AjaxResult.error("请选择学校");
    	}
    	
    	if(isSpecialChar(schoolCode.toString())||sqlValidate(schoolCode.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	Map map=new HashMap();
    	
    	map.put("member", memberQuery);
    	
    	
    	School schoolQuery=new School();
        
        
        if("物理".equals(memberQuery.getSxkm())) {
        	schoolQuery.setMajorType("理工类");
    	}
    	if("历史".equals(memberQuery.getSxkm())) {
    		schoolQuery.setMajorType("文史类");
    	}
    	
    	
    	//如果会员不是少数民族，则不能查询民族班
    	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
    		schoolQuery.setSsmzFlag(0);
    	}
    	
    	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
    		schoolQuery.setGjzxFlag(0);
    	}
    	
    	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
    		schoolQuery.setGxzxFlag(0);
    	}
    	
    	//考生的再选科目
    	schoolQuery.setZxkm(memberQuery.getZxkm());   
        
    	schoolQuery.setScode(schoolCode);
                
        int pageRow=0;
        
        schoolQuery.setPageNum(pageRow);
        
        
        List<SysDictData> dataList = dictTypeService.selectDictDataByType("school_level");
        
        
        List<School> list = schoolService.selectSchoolList4Page(schoolQuery);
        if(list!=null&&list.size()>0) {
        	School school=list.get(0);
        	String collegeLevel=school.getCollegeLevel();
        	if(collegeLevel!=null&&!collegeLevel.trim().equals("")) {
        		String collegeLevelStr="";
        		String[] collegeLevelArr= collegeLevel.split(",");
        		for(int i=0;i<dataList.size();i++) {
        			SysDictData data= dataList.get(i);
        			for(int j=0;j<collegeLevelArr.length;j++) {
        				if(data.getDictValue().equals(collegeLevelArr[j])) {
        					collegeLevelStr=collegeLevelStr+"<span>"+data.getDictLabel()+"</span>";
        				}
        			}
        		}
        		
        		school.setCollegeLevel(collegeLevelStr);
        	}
        	map.put("school", school);
        	
        	boolean qgjfFlag=true;//是否认可全国加分
        	if(school.getRemark()!=null) {
        		if(school.getRemark().indexOf("不认可加分")>-1) {//该学校不认可加分，则全国分只取高考分
        			qgjfFlag=false;
        		}
        	}
        	if(school.getAdmssionRule()!=null) {
        		if(school.getAdmssionRule().indexOf("不认可加分")>-1) {//该学校不认可加分，则全国分只取高考分
        			qgjfFlag=false;
        		}
        	}
        	
        	String provinceName=school.getProvinceName();
        	
        	
        	schoolCode="'"+schoolCode+"'";
        	
        	//查询专业组
        	SchoolPlan schoolPlanQuery=new SchoolPlan();
        	schoolPlanQuery.setYear(thisYear);
        	schoolPlanQuery.setSchoolCode(schoolCode);
        	if("物理".equals(memberQuery.getSxkm())) {
        		schoolPlanQuery.setMajorType("理工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		schoolPlanQuery.setMajorType("文史类");
        	}
        	
        	
        	//如果会员不是少数民族，则不能查询民族班
        	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
        		schoolPlanQuery.setSsmzFlag(0);
        	}
        	
        	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
        		schoolPlanQuery.setGjzxFlag(0);
        	}
        	
        	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
        		schoolPlanQuery.setGxzxFlag(0);
        	}
        	
        	//考生的再选科目
        	schoolPlanQuery.setZxkm(memberQuery.getZxkm());
        	
        	//List<SchoolPlan> zyzList =schoolPlanService.selectSchoolZyzList(schoolPlanQuery);
        	
        	List<SchoolPlan> zyzList =schoolPlanService.selectSchoolZyzPlanList(schoolPlanQuery);
        	
        	map.put("zyzList", zyzList);
        	
        	
        	List<SchoolPlan> plans2023List =schoolPlanService.selectSchoolZyz2023PlanList(schoolPlanQuery);
        	
        	
        	//查询各个专业组近3年的平均分、最低分（当前计算，先以2020,2021,2022这3年的录取数据为模拟数据）
        	SchoolMajorYearAdmission schoolMajorYearAdmission=new SchoolMajorYearAdmission();
        	schoolMajorYearAdmission.setYear(thisYear);
        	schoolMajorYearAdmission.setsCode(schoolCode);
        	if("物理".equals(memberQuery.getSxkm())) {
        		schoolMajorYearAdmission.setMajorType("理工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		schoolMajorYearAdmission.setMajorType("文史类");
        	}
        	
        	//如果会员不是少数民族，则不能查询民族班
        	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
        		schoolMajorYearAdmission.setSsmzFlag(0);
        	}
        	
        	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
        		schoolMajorYearAdmission.setGjzxFlag(0);
        	}
        	
        	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
        		schoolMajorYearAdmission.setGxzxFlag(0);
        	}
        	
        	//考生的再选科目
        	schoolMajorYearAdmission.setZxkm(memberQuery.getZxkm());
        	
        	List<SchoolMajorYearAdmission> zyzGradeList=schoolMajorYearAdmissionService.selectSchoolZyzYearAdmissionList(schoolMajorYearAdmission);
        	
        	//查询当年考生的排位(先用2023年的一分一档)，拿到2023年该分数的排位，取出2022、2021、2020年的同位分
        	
        	int gxpw=99999999;
        	
        	//广西排位分
        	GkGradeDoc gkGradeDoc=new GkGradeDoc();
        	gkGradeDoc.setGrade(memberQuery.getGxgrade());
        	gkGradeDoc.setYear(gradeLineYear);
        	if("物理".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("史类");
        	}
        	List<GkGradeDoc> gradeList=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);
        	
        	for(int z=0;z<gradeList.size();z++) {
        		GkGradeDoc gradeDoc=gradeList.get(z);
        		if(gradeDoc.getUseIn().equals("广西")) {
        			gxpw=gradeDoc.getSeq();
        		}
        	}
        	
        	//查找近3年的广西同位分
        	gkGradeDoc=new GkGradeDoc();
        	if("物理".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("史类");
        	}
        	gkGradeDoc.setUseIn("广西");
        	gkGradeDoc.setSeq(gxpw);
        	List<GkGradeDoc> gxpwGradeList=gkGradeDocService.selectGkGradeDocListBySeq(gkGradeDoc);
        	List<GkGradeDoc> gxLastPwGradeList=gkGradeDocService.selectGkGradeDocLastRecordList(gkGradeDoc);
        	
        	
        	int qgpw=99999999;
        	
        	
        	int temp_qgjfpw=99999999;//全国加分的排位(认可加分)
        	int temp_qgpw=99999999;//全国加分的排位(不认可加分)
        	
        	
        	//全国认可加分排位分
        	gkGradeDoc=new GkGradeDoc();
        	gkGradeDoc.setGrade(memberQuery.getQggrade());
        	
        	gkGradeDoc.setYear(2024);
        	if("物理".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("史类");
        	}
        	List<GkGradeDoc> gradeList2=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);
        	
        	for(int z=0;z<gradeList2.size();z++) {
        		GkGradeDoc gradeDoc=gradeList2.get(z);
        		
        		if(gradeDoc.getUseIn().equals("全国")) {
        			temp_qgjfpw=gradeDoc.getSeq();//认可加分的排位分
        		}
        	}
        	
        	//全国不认可加分排位分
        	gkGradeDoc=new GkGradeDoc();
        	gkGradeDoc.setGrade(memberQuery.getGrade());
        	
        	gkGradeDoc.setYear(2024);
        	if("物理".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("史类");
        	}
        	List<GkGradeDoc> gradeList3=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);
        	
        	for(int z=0;z<gradeList3.size();z++) {
        		GkGradeDoc gradeDoc=gradeList3.get(z);
        		
        		if(gradeDoc.getUseIn().equals("全国")) {
        			temp_qgpw=gradeDoc.getSeq();//认可加分的排位分
        		}
        	}
        	
        	
        	
        	
        	//查找进3年的全国同位分（认可加分的排位）
        	gkGradeDoc=new GkGradeDoc();
        	if("物理".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("史类");
        	}
        	gkGradeDoc.setUseIn("全国");
        	gkGradeDoc.setSeq(temp_qgjfpw);
        	List<GkGradeDoc> qgpwGradeList=gkGradeDocService.selectGkGradeDocListBySeq(gkGradeDoc);
        	List<GkGradeDoc> qgLastPwGradeList=gkGradeDocService.selectGkGradeDocLastRecordList(gkGradeDoc);
        	
        	//不认可加分的排位
        	gkGradeDoc.setSeq(temp_qgpw);
        	List<GkGradeDoc> qgpwNoAddGradeList=gkGradeDocService.selectGkGradeDocListBySeq(gkGradeDoc);
        	
        	
        	
        	int gxj2022=0;
        	int gxj2021=0;
        	int gxj2020=0;
        	for(int i=0;i<gxpwGradeList.size();i++) {
        		GkGradeDoc gxGradeDoc=gxpwGradeList.get(i);
        		if(gxGradeDoc.getYear().intValue()==yearNew1) {
        			gxj2022=gxGradeDoc.getGrade();
        		}
        		if(gxGradeDoc.getYear().intValue()==yearNew2) {
        			gxj2021=gxGradeDoc.getGrade();
        		}
        		if(gxGradeDoc.getYear().intValue()==yearNew3) {
        			gxj2020=gxGradeDoc.getGrade();
        		}
        	}
        	if(gxj2022==0) {
        		for(int i=0;i<gxLastPwGradeList.size();i++) {
            		GkGradeDoc gxGradeDoc=gxLastPwGradeList.get(i);
            		if(gxGradeDoc.getYear().intValue()==yearNew1) {
            			gxj2022=gxGradeDoc.getGrade();
            		}
        		}
        	}
        	if(gxj2021==0) {
        		for(int i=0;i<gxLastPwGradeList.size();i++) {
            		GkGradeDoc gxGradeDoc=gxLastPwGradeList.get(i);
            		if(gxGradeDoc.getYear().intValue()==yearNew2) {
            			gxj2021=gxGradeDoc.getGrade();
            		}
        		}
        	}
        	if(gxj2020==0) {
        		for(int i=0;i<gxLastPwGradeList.size();i++) {
            		GkGradeDoc gxGradeDoc=gxLastPwGradeList.get(i);
            		if(gxGradeDoc.getYear().intValue()==yearNew3) {
            			gxj2020=gxGradeDoc.getGrade();
            		}
        		}
        	}
        	
        	
        	int qgj2022=0;
        	int qgj2021=0;
        	int qgj2020=0;
        	if(qgjfFlag) {//认可加分
        		qgpw=temp_qgjfpw;
        		for(int z=0;z<qgpwGradeList.size();z++) {
            		GkGradeDoc gxGradeDoc=qgpwGradeList.get(z);
            		if(gxGradeDoc.getYear().intValue()==yearNew1) {
            			qgj2022=gxGradeDoc.getGrade();
            		}
            		if(gxGradeDoc.getYear().intValue()==yearNew2) {
            			qgj2021=gxGradeDoc.getGrade();
            		}
            		if(gxGradeDoc.getYear().intValue()==yearNew3) {
            			qgj2020=gxGradeDoc.getGrade();
            		}
            	}
        	}else {//不认可加分
        		qgpw=temp_qgpw;
        		for(int z=0;z<qgpwNoAddGradeList.size();z++) {
            		GkGradeDoc gxGradeDoc=qgpwNoAddGradeList.get(z);
            		if(gxGradeDoc.getYear().intValue()==yearNew1) {
            			qgj2022=gxGradeDoc.getGrade();
            		}
            		if(gxGradeDoc.getYear().intValue()==yearNew2) {
            			qgj2021=gxGradeDoc.getGrade();
            		}
            		if(gxGradeDoc.getYear().intValue()==yearNew3) {
            			qgj2020=gxGradeDoc.getGrade();
            		}
            	}
        	}
        	if(qgj2022==0) {
        		for(int z=0;z<qgLastPwGradeList.size();z++) {
            		GkGradeDoc gxGradeDoc=qgLastPwGradeList.get(z);
            		if(gxGradeDoc.getYear().intValue()==yearNew1) {
            			qgj2022=gxGradeDoc.getGrade();
            		}
        		}
        	}
        	if(qgj2021==0) {
        		for(int z=0;z<qgLastPwGradeList.size();z++) {
            		GkGradeDoc gxGradeDoc=qgLastPwGradeList.get(z);
            		if(gxGradeDoc.getYear().intValue()==yearNew2) {
            			qgj2021=gxGradeDoc.getGrade();
            		}
        		}
        	}
        	if(qgj2020==0) {
        		for(int z=0;z<qgLastPwGradeList.size();z++) {
            		GkGradeDoc gxGradeDoc=qgLastPwGradeList.get(z);
            		if(gxGradeDoc.getYear().intValue()==yearNew3) {
            			qgj2020=gxGradeDoc.getGrade();
            		}
        		}
        	}
        	
        	
        	
        	
        	//查询历年一分一档，用于计算平均分排位和最低分排位
        	GkGradeDoc hisGkGradeDoc=new GkGradeDoc();
        	if("物理".equals(memberQuery.getSxkm())) {
        		hisGkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		hisGkGradeDoc.setGradeClass("史类");
        	}
        	
        	List<GkGradeDoc> hisPwGradeList=gkGradeDocService.selectGkGradeDocList(hisGkGradeDoc);
        	
        	
        	
        	//专业组投档概率
        	List<School> returnList =new ArrayList();
        	
        	
        	DecimalFormat df = new DecimalFormat("#.00");
        	//开始计算专业组投档率
        	if(zyzList!=null&&zyzList.size()>0) {
        		SchoolPlan zyzPlan=zyzList.get(0);//取出该学校第一个专业组
        		
        		
        		
        		String zyz=zyzPlan.getZyz();
				
				
				int avgGrade2022=0;
				int minGrade2022=0;
				int avgGrade2021=0;
				int minGrade2021=0;
				int avgGrade2020=0;
				int minGrade2020=0;
				
				//历史招生数量，从指南取
				int plan2022=0;
				int submit2022=0;
				int adm2022=0;
				int plan2021=0;
				int submit2021=0;
				int adm2021=0;
				int plan2020=0;
				int submit2020=0;
				int adm2020=0;
				
				//当年招生数量，从招生计划取
				int plan2023=0;
				
				School schoolRecord2022=new School();
				schoolRecord2022.setProvinceName(provinceName);
				schoolRecord2022.setSname(school.getSname());
				schoolRecord2022.setScode(school.getScode());
				schoolRecord2022.setZyz(zyz);
				schoolRecord2022.setZxkm(zyzPlan.getKm2());
				schoolRecord2022.setYear(yearNew1);
				schoolRecord2022.setSranking(school.getSranking());
				
				if(provinceName.equals("广西")) {
					schoolRecord2022.setSeqGrade(new Integer(gxj2022).toString());
					schoolRecord2022.setSeq(new Integer(gxpw).toString());
				}else {
					schoolRecord2022.setSeqGrade(new Integer(qgj2022).toString());
					schoolRecord2022.setSeq(new Integer(qgpw).toString());
				}
				
				
				//设置分数线
				if("物理".equals(memberQuery.getSxkm())) {
					schoolRecord2022.setGradeLine(new Integer(gradeLineLg2022).toString());
				}
				if("历史".equals(memberQuery.getSxkm())) {
					schoolRecord2022.setGradeLine(new Integer(gradeLineWs2022).toString());
				}
				
				SchoolMajorYearAdmission admission2022=null;
				SchoolMajorYearAdmission admission2021=null;
				SchoolMajorYearAdmission admission2020=null;
				for(int j=0;j<zyzGradeList.size();j++) {
					SchoolMajorYearAdmission admission=zyzGradeList.get(j);
					String zyzAdmin=admission.getZyz();
					
					if(zyz.equals(zyzAdmin)&&admission.getsCode().equals(zyzPlan.getSchoolCode())) {//同一个学校的专业组        						
						if(admission.getYear()==yearNew1) {
							admission2022=admission;
						}
						if(admission.getYear()==yearNew2) {
							admission2021=admission;
						}
						if(admission.getYear()==yearNew3) {
							admission2020=admission;
						}
					}
				}
				if(admission2022!=null&&admission2022.getAvgGrade()!=null) {
					schoolRecord2022.setAvgGrade(admission2022.getAvgGrade().toString());
					schoolRecord2022.setMinGrade(admission2022.getLowGrade().toString());
					avgGrade2022=admission2022.getAvgGrade();
					minGrade2022=admission2022.getLowGrade();
					
					
					
					
					//计算平均分排位，最低分排位
					int avgGrade2022Seq=99999999;
					int lastSeq=1;
					for(int m=0;m<hisPwGradeList.size();m++) {
						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
						if(hisGradeDoc.getYear().intValue()==yearNew1) {
							
							
							int myGrade=hisGradeDoc.getGrade();
							
							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
								if(hisGradeDoc.getUseIn().equals("广西")) {
									int fencha=myGrade-avgGrade2022;
									if(fencha==0) {
										avgGrade2022Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										avgGrade2022Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
									
								}
							}else {
								if(hisGradeDoc.getUseIn().equals("全国")) {
									int fencha=myGrade-avgGrade2022;
									if(fencha==0) {
										avgGrade2022Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										avgGrade2022Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
								}
							}
							
						}
					}
					
					schoolRecord2022.setAvgGradeSeq(new Integer(avgGrade2022Seq).toString());
					
					
					int minGrade2022Seq=99999999;
					lastSeq=1;
					for(int m=0;m<hisPwGradeList.size();m++) {
						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
						if(hisGradeDoc.getYear().intValue()==yearNew1) {
							
							
							int myGrade=hisGradeDoc.getGrade();
							
							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
								if(hisGradeDoc.getUseIn().equals("广西")) {
									int fencha=myGrade-minGrade2022;
									if(fencha==0) {
										minGrade2022Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										minGrade2022Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
									
								}
							}else {
								if(hisGradeDoc.getUseIn().equals("全国")) {
									int fencha=myGrade-minGrade2022;
									if(fencha==0) {
										minGrade2022Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										minGrade2022Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
								}
							}
							
						}
					}

					schoolRecord2022.setMinGradeSeq(new Integer(minGrade2022Seq).toString());
					
					
					
					
					
					
					
				}else {
					schoolRecord2022.setAvgGrade("-");
					schoolRecord2022.setMinGrade("-");
					schoolRecord2022.setAvgGradeSeq("-");
					schoolRecord2022.setMinGradeSeq("-");
				}
				
				if(admission2022!=null) {
					plan2022=admission2022.getPlan();
					
					if(admission2022.getSubmit()!=null) {
						submit2022=admission2022.getSubmit();
					}
					adm2022=admission2022.getAdmission();
					schoolRecord2022.setPlanSubmitAdmission(plan2022+"-"+adm2022);
					}
				
				
				for(int j=0;j<plans2023List.size();j++) {
					SchoolPlan schoolPlan2023=plans2023List.get(j);
					if(zyz.equals(schoolPlan2023.getZyz())&&zyzPlan.getSchoolCode().equals(schoolPlan2023.getSchoolCode())) {//同一个学校的专业组        	
						plan2023=schoolPlan2023.getMajorPlan();
					}
				}
        		
        		
        		
				School schoolRecord2021=new School();
				schoolRecord2021.setProvinceName(provinceName);
				schoolRecord2021.setSname(school.getSname());
				schoolRecord2021.setScode(school.getScode());
				schoolRecord2021.setZyz(zyz);
				schoolRecord2021.setZxkm(zyzPlan.getKm2());
				schoolRecord2021.setYear(yearNew2);
				schoolRecord2021.setSranking(school.getSranking());
				
				if(provinceName.equals("广西")) {
					schoolRecord2021.setSeqGrade(new Integer(gxj2021).toString());
					schoolRecord2021.setSeq(new Integer(gxpw).toString());
				}else {
					schoolRecord2021.setSeqGrade(new Integer(qgj2021).toString());
					schoolRecord2021.setSeq(new Integer(qgpw).toString());
				}
				
				
				//设置分数线
				if("物理".equals(memberQuery.getSxkm())) {
					schoolRecord2021.setGradeLine(new Integer(gradeLineLg2021).toString());
				}
				if("历史".equals(memberQuery.getSxkm())) {
					schoolRecord2021.setGradeLine(new Integer(gradeLineWs2021).toString());
				}
				
				if(admission2021!=null&&admission2021.getAvgGrade()!=null) {
					schoolRecord2021.setAvgGrade(admission2021.getAvgGrade().toString());
					schoolRecord2021.setMinGrade(admission2021.getLowGrade().toString());
					avgGrade2021=admission2021.getAvgGrade();
					minGrade2021=admission2021.getLowGrade();
					
					
					
					
					//计算平均分排位，最低分排位
					int avgGrade2021Seq=99999999;
					int lastSeq=1;
					for(int m=0;m<hisPwGradeList.size();m++) {
						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
						if(hisGradeDoc.getYear().intValue()==yearNew2) {
							
							
							int myGrade=hisGradeDoc.getGrade();
							
							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
								if(hisGradeDoc.getUseIn().equals("广西")) {
									int fencha=myGrade-avgGrade2021;
									if(fencha==0) {
										avgGrade2021Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										avgGrade2021Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
									
								}
							}else {
								if(hisGradeDoc.getUseIn().equals("全国")) {
									int fencha=myGrade-avgGrade2021;
									if(fencha==0) {
										avgGrade2021Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										avgGrade2021Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
								}
							}
							
						}
					}
					
					schoolRecord2021.setAvgGradeSeq(new Integer(avgGrade2021Seq).toString());
					
					
					int minGrade2021Seq=99999999;
					lastSeq=1;
					for(int m=0;m<hisPwGradeList.size();m++) {
						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
						if(hisGradeDoc.getYear().intValue()==yearNew2) {
							
							
							int myGrade=hisGradeDoc.getGrade();
							
							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
								if(hisGradeDoc.getUseIn().equals("广西")) {
									int fencha=myGrade-minGrade2021;
									if(fencha==0) {
										minGrade2021Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										minGrade2021Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
									
								}
							}else {
								if(hisGradeDoc.getUseIn().equals("全国")) {
									int fencha=myGrade-minGrade2021;
									if(fencha==0) {
										minGrade2021Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										minGrade2021Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
								}
							}
							
						}
					}
					
					schoolRecord2021.setMinGradeSeq(new Integer(minGrade2021Seq).toString());
					
					
					
					
					
					
				}else {
					schoolRecord2021.setAvgGrade("-");
					schoolRecord2021.setMinGrade("-");
					schoolRecord2021.setAvgGradeSeq("-");
					schoolRecord2021.setMinGradeSeq("-");
				}
				if(admission2021!=null) {
					plan2021=admission2021.getPlan();
					if(admission2021.getSubmit()!=null) {
						submit2021=admission2021.getSubmit();
					}
					adm2021=admission2021.getAdmission();
					schoolRecord2021.setPlanSubmitAdmission(plan2021+"-"+adm2021);
				}
				
				
				School schoolRecord2020=new School();
				schoolRecord2020.setProvinceName(provinceName);
				schoolRecord2020.setSname(school.getSname());
				schoolRecord2020.setScode(school.getScode());
				schoolRecord2020.setZyz(zyz);
				schoolRecord2020.setZxkm(zyzPlan.getKm2());
				schoolRecord2020.setYear(yearNew3);
				schoolRecord2020.setSranking(school.getSranking());
				
				if(provinceName.equals("广西")) {
					schoolRecord2020.setSeqGrade(new Integer(gxj2020).toString());
					schoolRecord2020.setSeq(new Integer(gxpw).toString());
				}else {
					schoolRecord2020.setSeqGrade(new Integer(qgj2020).toString());
					schoolRecord2020.setSeq(new Integer(qgpw).toString());
				}
				
				
				//设置分数线
				if("物理".equals(memberQuery.getSxkm())) {
					schoolRecord2020.setGradeLine(new Integer(gradeLineLg2020).toString());
				}
				if("历史".equals(memberQuery.getSxkm())) {
					schoolRecord2020.setGradeLine(new Integer(gradeLineWs2020).toString());
				}
				
				if(admission2020!=null&&admission2020.getAvgGrade()!=null) {
					schoolRecord2020.setAvgGrade(admission2020.getAvgGrade().toString());
					schoolRecord2020.setMinGrade(admission2020.getLowGrade().toString());
					avgGrade2020=admission2020.getAvgGrade();
					minGrade2020=admission2020.getLowGrade();        		
					
					
					
					
					//计算平均分排位，最低分排位
					int avgGrade2020Seq=99999999;
					int lastSeq=1;
					for(int m=0;m<hisPwGradeList.size();m++) {
						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
						if(hisGradeDoc.getYear().intValue()==yearNew3) {
							
							
							int myGrade=hisGradeDoc.getGrade();
							
							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
								if(hisGradeDoc.getUseIn().equals("广西")) {
									int fencha=myGrade-avgGrade2020;
									if(fencha==0) {
										avgGrade2020Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										avgGrade2020Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
									
								}
							}else {
								if(hisGradeDoc.getUseIn().equals("全国")) {
									int fencha=myGrade-avgGrade2020;
									if(fencha==0) {
										avgGrade2020Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										avgGrade2020Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
								}
							}
							
						}
					}
					
					schoolRecord2020.setAvgGradeSeq(new Integer(avgGrade2020Seq).toString());
					
					
					int minGrade2020Seq=99999999;
					lastSeq=1;
					for(int m=0;m<hisPwGradeList.size();m++) {
						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
						if(hisGradeDoc.getYear().intValue()==yearNew3) {
							
							
							int myGrade=hisGradeDoc.getGrade();
							
							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
								if(hisGradeDoc.getUseIn().equals("广西")) {
									int fencha=myGrade-minGrade2020;
									if(fencha==0) {
										minGrade2020Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										minGrade2020Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
									
								}
							}else {
								if(hisGradeDoc.getUseIn().equals("全国")) {
									int fencha=myGrade-minGrade2020;
									if(fencha==0) {
										minGrade2020Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										minGrade2020Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
								}
							}
							
						}
					}
					
					schoolRecord2020.setMinGradeSeq(new Integer(minGrade2020Seq).toString());
					
					
					
					
					
					
					
				}else {
					schoolRecord2020.setAvgGrade("-");
					schoolRecord2020.setMinGrade("-");
					schoolRecord2020.setAvgGradeSeq("-");
					schoolRecord2020.setMinGradeSeq("-");
				}
				if(admission2020!=null) {
					plan2020=admission2020.getPlan();
					if(admission2020.getSubmit()!=null) {
						submit2020=admission2020.getSubmit();
					}
					adm2020=admission2020.getAdmission();
					schoolRecord2020.setPlanSubmitAdmission(plan2020+"-"+adm2020);
				}
				

				if(provinceName.equals("广西")) {//广西学校
					int userGrade=memberQuery.getGxgrade();
					double rate=(userGrade-minGrade2022)/2+50;
					if(rate>=100) rate=99.99;
					if(rate<1) rate=1;
					schoolRecord2020.setSubmitRate(df.format(rate));
					schoolRecord2021.setSubmitRate(df.format(rate));
					schoolRecord2022.setSubmitRate(df.format(rate));
				}else {//全国学校
					if(qgjfFlag) {//认可加分
						int userGrade=memberQuery.getQggrade();
    					double rate=(userGrade-minGrade2022)/2+50;
    					if(rate>=100) rate=99.99;
						if(rate<1) rate=1;
						schoolRecord2020.setSubmitRate(df.format(rate));
						schoolRecord2021.setSubmitRate(df.format(rate));
						schoolRecord2022.setSubmitRate(df.format(rate));
					}else {
						int userGrade=memberQuery.getGrade();
    					double rate=(userGrade-minGrade2022)/2+50;
    					if(rate>=100) rate=99.99;
						if(rate<1) rate=1;
						schoolRecord2020.setSubmitRate(df.format(rate));
						schoolRecord2021.setSubmitRate(df.format(rate));
						schoolRecord2022.setSubmitRate(df.format(rate));
					}
					
				}	
				
				if(schoolRecord2022.getSubmitRate()==null) {
					schoolRecord2022.setSubmitRate("-");
				}
				if(schoolRecord2022.getPlanSubmitAdmission()==null) {
					schoolRecord2022.setPlanSubmitAdmission("-");
				}
				
				
				if(schoolRecord2022.getAvgGradeSeq()==null||schoolRecord2022.getAvgGradeSeq().equals("99999999")) {
					schoolRecord2022.setAvgGradeSeq("-");
				}
				
				if(schoolRecord2022.getMinGradeSeq()==null||schoolRecord2022.getMinGradeSeq().equals("99999999")) {
					schoolRecord2022.setMinGradeSeq("-");
				}
				
				if(schoolRecord2021.getSubmitRate()==null) {
					schoolRecord2021.setSubmitRate("-");
					
				}
				if(schoolRecord2021.getPlanSubmitAdmission()==null) {
					schoolRecord2021.setPlanSubmitAdmission("-");
				}
				
				if(schoolRecord2021.getAvgGradeSeq()==null||schoolRecord2021.getAvgGradeSeq().equals("99999999")) {
					schoolRecord2021.setAvgGradeSeq("-");
				}
				
				if(schoolRecord2021.getMinGradeSeq()==null||schoolRecord2021.getMinGradeSeq().equals("99999999")) {
					schoolRecord2021.setMinGradeSeq("-");
				}
				
				
				if(schoolRecord2020.getSubmitRate()==null) {
					schoolRecord2020.setSubmitRate("-");
				}
				if(schoolRecord2020.getPlanSubmitAdmission()==null) {
					schoolRecord2020.setPlanSubmitAdmission("-");
				}
				
				if(schoolRecord2020.getAvgGradeSeq()==null||schoolRecord2020.getAvgGradeSeq().equals("99999999")) {
					schoolRecord2020.setAvgGradeSeq("-");
				}
				
				if(schoolRecord2020.getMinGradeSeq()==null||schoolRecord2020.getMinGradeSeq().equals("99999999")) {
					schoolRecord2020.setMinGradeSeq("-");
				}
				
				
				
				
				
				returnList.add(schoolRecord2022);
				returnList.add(schoolRecord2021);
				returnList.add(schoolRecord2020);
        		
        		
				map.put("returnList", returnList);
        		
				
				
				/*******************************************
				 * 
				 * 计算该专业组下的各专业的录取概率
				 * 
				 */
				
        		
				//该专业组下各专业录取概率
				List<SchoolMajorYearAdmission> zyList =new ArrayList();
        		//该专业今年的招生计划（从计划表中取）
				schoolPlanQuery.setZyz(zyz);
				if("物理".equals(memberQuery.getSxkm())) {
	        		schoolPlanQuery.setMajorType("理工类");
	        	}
	        	if("历史".equals(memberQuery.getSxkm())) {
	        		schoolPlanQuery.setMajorType("文史类");
	        	}
	        	
	        	//如果会员不是少数民族，则不能查询民族班
	        	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
	        		schoolPlanQuery.setSsmzFlag(0);
	        	}
	        	
	        	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
	        		schoolPlanQuery.setGjzxFlag(0);
	        	}
	        	
	        	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
	        		schoolPlanQuery.setGxzxFlag(0);
	        	}
				List<SchoolPlan> zyPlans2023List =schoolPlanService.selectSchoolZyPlan2023List(schoolPlanQuery);
				
				//该专业当年的招生计划和录取情况（从录取指南中取）
				//查询各个专业近3年的平均分、最低分（当前计算，先以2020,2021,2022这3年的录取数据为模拟数据）
	        	SchoolMajorYearAdmission schoolMajorYearAdmissionQuery=new SchoolMajorYearAdmission();
	        	schoolMajorYearAdmissionQuery.setYear(thisYear);
	        	schoolMajorYearAdmissionQuery.setsCode(schoolCode);
	        	if("物理".equals(memberQuery.getSxkm())) {
	        		schoolMajorYearAdmissionQuery.setMajorType("理工类");
	        	}
	        	if("历史".equals(memberQuery.getSxkm())) {
	        		schoolMajorYearAdmissionQuery.setMajorType("文史类");
	        	}
	        	schoolMajorYearAdmissionQuery.setZyz(zyz);
	        	
	        	//如果会员不是少数民族，则不能查询民族班
	        	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
	        		schoolMajorYearAdmission.setSsmzFlag(0);
	        	}
	        	
	        	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
	        		schoolMajorYearAdmission.setGjzxFlag(0);
	        	}
	        	
	        	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
	        		schoolMajorYearAdmission.setGxzxFlag(0);
	        	}
	        	
	        	//考生的再选科目
	        	schoolMajorYearAdmission.setZxkm(memberQuery.getZxkm());
	        	
	        	List<SchoolMajorYearAdmission> majorGradeList=schoolMajorYearAdmissionService.selectSchoolMajorZyYearAdmissionList(schoolMajorYearAdmissionQuery);
	        	
	        	//各专业录取明细
	        	//List<SchoolMajorYearAdmission> majorGradeDetailList=schoolMajorYearAdmissionService.selectSchoolMajorZyYearAdmissionDetailList(schoolMajorYearAdmissionQuery);
	        	
	        	
	        	for(int k=0;k<zyPlans2023List.size();k++) {
	        		SchoolPlan schoolPlan=zyPlans2023List.get(k);
	        		
	        		int zyavgGrade2022=0;
    				int zyminGrade2022=0;
    				int zyavgGrade2021=0;
    				int zyminGrade2021=0;
    				int zyavgGrade2020=0;
    				int zyminGrade2020=0;
    				
    				//历史招生数量，从指南取
    				int zyplan2022=0;
    				int zysubmit2022=0;
    				int zyadm2022=0;
    				int zyplan2021=0;
    				int zysubmit2021=0;
    				int zyadm2021=0;
    				int zyplan2020=0;
    				int zysubmit2020=0;
    				int zyadm2020=0;
    				
    				//当年招生数量，从招生计划取
    				int zyplan2023=schoolPlan.getMajorPlan();
	        		
	        		SchoolMajorYearAdmission schoolMajorYearAdmission2022=new SchoolMajorYearAdmission();
	        		schoolMajorYearAdmission2022.setYear(yearNew1);
	        		schoolMajorYearAdmission2022.setMajorCode(schoolPlan.getMajorCode());
	        		schoolMajorYearAdmission2022.setMajorSeq(schoolPlan.getMajorSeq());
	        		schoolMajorYearAdmission2022.setMajor(schoolPlan.getMajorName());
	        		schoolMajorYearAdmission2022.setThisYearMajorPlan(schoolPlan.getMajorPlan());
	        		schoolMajorYearAdmission2022.setsCode(schoolPlan.getSchoolCode());
	        		schoolMajorYearAdmission2022.setZyz(schoolPlan.getZyz());
	        		
	        		
	        		if(provinceName.equals("广西")) {
	        			schoolMajorYearAdmission2022.setSeqGrade(new Integer(gxj2022).toString());
	        			schoolMajorYearAdmission2022.setSeq(new Integer(gxpw).toString());
    				}else {
    					schoolMajorYearAdmission2022.setSeqGrade(new Integer(qgj2022).toString());
    					schoolMajorYearAdmission2022.setSeq(new Integer(qgpw).toString());
    				}
    				
    				
    				//设置分数线
    				if("物理".equals(memberQuery.getSxkm())) {
    					schoolMajorYearAdmission2022.setGradeLine(new Integer(gradeLineLg2022).toString());
    				}
    				if("历史".equals(memberQuery.getSxkm())) {
    					schoolMajorYearAdmission2022.setGradeLine(new Integer(gradeLineWs2022).toString());
    				}
    				
    				SchoolMajorYearAdmission zyadmission2022=null;
    				SchoolMajorYearAdmission zyadmission2021=null;
    				SchoolMajorYearAdmission zyadmission2020=null;
    				for(int j=0;j<majorGradeList.size();j++) {
    					SchoolMajorYearAdmission admission=majorGradeList.get(j);
    					
    					
    					if(schoolPlan.getMajorCode().equals(admission.getMajorCode())) {//同一个专业        						
    						if(admission.getYear()==yearNew1) {
    							zyadmission2022=admission;
    						}
    						if(admission.getYear()==yearNew2) {
    							zyadmission2021=admission;
    						}
    						if(admission.getYear()==yearNew3) {
    							zyadmission2020=admission;
    						}
    					}
    				}
    				
    				
    				if(zyadmission2022!=null&&zyadmission2022.getAvgGrade()!=null) {
    					schoolMajorYearAdmission2022.setAvgGradeStr(zyadmission2022.getAvgGrade().toString());
    					schoolMajorYearAdmission2022.setMinGradeStr(zyadmission2022.getLowGrade().toString());
                        schoolMajorYearAdmission2022.setAdmission(zyadmission2022.getAdmission());
    					zyavgGrade2022=zyadmission2022.getAvgGrade();
    					zyminGrade2022=zyadmission2022.getLowGrade();
    					
    					
    					//计算平均分排位，最低分排位
    					int avgGrade2022Seq=99999999;
    					int lastSeq=1;
    					for(int m=0;m<hisPwGradeList.size();m++) {
    						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
    						if(hisGradeDoc.getYear().intValue()==yearNew1) {
    							
    							
    							int myGrade=hisGradeDoc.getGrade();
    							
    							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
    								if(hisGradeDoc.getUseIn().equals("广西")) {
    									int fencha=myGrade-zyavgGrade2022;
    									if(fencha==0) {
    										avgGrade2022Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										avgGrade2022Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    									
    								}
    							}else {
    								if(hisGradeDoc.getUseIn().equals("全国")) {
    									int fencha=myGrade-zyavgGrade2022;
    									if(fencha==0) {
    										avgGrade2022Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										avgGrade2022Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    								}
    							}
    							
    						}
    					}
    					
    					schoolMajorYearAdmission2022.setAvgGradeSeq(new Integer(avgGrade2022Seq).toString());
    					
    					
    					int minGrade2022Seq=99999999;
    					lastSeq=1;
    					for(int m=0;m<hisPwGradeList.size();m++) {
    						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
    						if(hisGradeDoc.getYear().intValue()==yearNew1) {
    							
    							
    							int myGrade=hisGradeDoc.getGrade();
    							
    							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
    								if(hisGradeDoc.getUseIn().equals("广西")) {
    									int fencha=myGrade-zyminGrade2022;
    									if(fencha==0) {
    										minGrade2022Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										minGrade2022Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    									
    								}
    							}else {
    								if(hisGradeDoc.getUseIn().equals("全国")) {
    									int fencha=myGrade-zyminGrade2022;
    									if(fencha==0) {
    										minGrade2022Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										minGrade2022Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    								}
    							}
    							
    						}
    					}
    					
    					schoolMajorYearAdmission2022.setMinGradeSeq(new Integer(minGrade2022Seq).toString());
    					
    					
    				}else {
    					schoolMajorYearAdmission2022.setAvgGradeStr("-");
    					schoolMajorYearAdmission2022.setMinGradeStr("-");
    					schoolMajorYearAdmission2022.setAvgGradeSeq("-");
    					schoolMajorYearAdmission2022.setMinGradeSeq("-");
    				}
    				
    				if(zyadmission2022!=null&&zyadmission2022.getPlan()!=null) {
	    				zyplan2022=zyadmission2022.getPlan();
						
						schoolMajorYearAdmission2022.setMajorPlan(zyplan2022);
						
						if(zyadmission2022.getSubmit()!=null) {
							zysubmit2022=zyadmission2022.getSubmit();
						}
						if(zyadmission2022.getAdmission()!=null) {
							zyadm2022=zyadmission2022.getAdmission();
						}
						
						schoolMajorYearAdmission2022.setPlanSubmitAdmission(plan2022+"-"+adm2022);
    				}
    				

    				SchoolMajorYearAdmission schoolMajorYearAdmission2021=new SchoolMajorYearAdmission();
	        		schoolMajorYearAdmission2021.setYear(yearNew2);
	        		schoolMajorYearAdmission2021.setMajorCode(schoolPlan.getMajorCode());
	        		schoolMajorYearAdmission2021.setMajorSeq(schoolPlan.getMajorSeq());
	        		schoolMajorYearAdmission2021.setMajor(schoolPlan.getMajorName());
	        		schoolMajorYearAdmission2021.setThisYearMajorPlan(schoolPlan.getMajorPlan());
	        		schoolMajorYearAdmission2021.setsCode(schoolPlan.getSchoolCode());
	        		schoolMajorYearAdmission2021.setZyz(schoolPlan.getZyz());
	        		
	        		
	        		if(provinceName.equals("广西")) {
	        			schoolMajorYearAdmission2021.setSeqGrade(new Integer(gxj2021).toString());
	        			schoolMajorYearAdmission2021.setSeq(new Integer(gxpw).toString());
    				}else {
    					schoolMajorYearAdmission2021.setSeqGrade(new Integer(qgj2021).toString());
    					schoolMajorYearAdmission2021.setSeq(new Integer(qgpw).toString());
    				}
    				
    				
    				//设置分数线
    				if("物理".equals(memberQuery.getSxkm())) {
    					schoolMajorYearAdmission2021.setGradeLine(new Integer(gradeLineLg2021).toString());
    				}
    				if("历史".equals(memberQuery.getSxkm())) {
    					schoolMajorYearAdmission2021.setGradeLine(new Integer(gradeLineWs2021).toString());
    				}
    				
    				
    				
    				
    				if(zyadmission2021!=null&&zyadmission2021.getAvgGrade()!=null) {
    					schoolMajorYearAdmission2021.setAvgGradeStr(zyadmission2021.getAvgGrade().toString());
    					schoolMajorYearAdmission2021.setMinGradeStr(zyadmission2021.getLowGrade().toString());
                        schoolMajorYearAdmission2021.setAdmission(zyadmission2021.getAdmission());
    					zyavgGrade2021=zyadmission2021.getAvgGrade();
    					zyminGrade2021=zyadmission2021.getLowGrade();
    					
    					
    					//计算平均分排位，最低分排位
    					int avgGrade2021Seq=99999999;
    					int lastSeq=1;
    					for(int m=0;m<hisPwGradeList.size();m++) {
    						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
    						if(hisGradeDoc.getYear().intValue()==2021) {
    							
    							
    							int myGrade=hisGradeDoc.getGrade();
    							
    							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
    								if(hisGradeDoc.getUseIn().equals("广西")) {
    									int fencha=myGrade-zyavgGrade2021;
    									if(fencha==0) {
    										avgGrade2021Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										avgGrade2021Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    									
    								}
    							}else {
    								if(hisGradeDoc.getUseIn().equals("全国")) {
    									int fencha=myGrade-zyavgGrade2021;
    									if(fencha==0) {
    										avgGrade2021Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										avgGrade2021Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    								}
    							}
    							
    						}
    					}
    					
    					schoolMajorYearAdmission2021.setAvgGradeSeq(new Integer(avgGrade2021Seq).toString());
    					
    					
    					int minGrade2021Seq=99999999;
    					lastSeq=1;
    					for(int m=0;m<hisPwGradeList.size();m++) {
    						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
    						if(hisGradeDoc.getYear().intValue()==yearNew2) {
    							
    							
    							int myGrade=hisGradeDoc.getGrade();
    							
    							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
    								if(hisGradeDoc.getUseIn().equals("广西")) {
    									int fencha=myGrade-zyminGrade2021;
    									if(fencha==0) {
    										minGrade2021Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										minGrade2021Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    									
    								}
    							}else {
    								if(hisGradeDoc.getUseIn().equals("全国")) {
    									int fencha=myGrade-zyminGrade2021;
    									if(fencha==0) {
    										minGrade2021Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										minGrade2021Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    								}
    							}
    							
    						}
    					}
    					
    					schoolMajorYearAdmission2021.setMinGradeSeq(new Integer(minGrade2021Seq).toString());
    					
    					
    					
    					
    				}else {
    					schoolMajorYearAdmission2021.setAvgGradeStr("-");
    					schoolMajorYearAdmission2021.setMinGradeStr("-");
    					schoolMajorYearAdmission2021.setMinGradeSeq("-");
    					schoolMajorYearAdmission2021.setAvgGradeSeq("-");
    				}
    				
    				if(zyadmission2021!=null&&zyadmission2021.getPlan()!=null) {
	    				zyplan2021=zyadmission2021.getPlan();
						schoolMajorYearAdmission2021.setMajorPlan(zyplan2021);
						if(zyadmission2021.getSubmit()!=null) {
							zysubmit2021=zyadmission2021.getSubmit();
						}
						if(zyadmission2021.getAdmission()!=null) {
							zyadm2021=zyadmission2021.getAdmission();
						}
						schoolMajorYearAdmission2021.setPlanSubmitAdmission(plan2021+"-"+adm2021);
    				}
    				
    				
    				SchoolMajorYearAdmission schoolMajorYearAdmission2020=new SchoolMajorYearAdmission();
	        		schoolMajorYearAdmission2020.setYear(yearNew3);
	        		schoolMajorYearAdmission2020.setMajorCode(schoolPlan.getMajorCode());
	        		schoolMajorYearAdmission2020.setMajorSeq(schoolPlan.getMajorSeq());
	        		schoolMajorYearAdmission2020.setMajor(schoolPlan.getMajorName());
	        		schoolMajorYearAdmission2020.setThisYearMajorPlan(schoolPlan.getMajorPlan());
	        		schoolMajorYearAdmission2020.setsCode(schoolPlan.getSchoolCode());
	        		schoolMajorYearAdmission2020.setZyz(schoolPlan.getZyz());
	        		
	        		
	        		if(provinceName.equals("广西")) {
	        			schoolMajorYearAdmission2020.setSeqGrade(new Integer(gxj2020).toString());
	        			schoolMajorYearAdmission2020.setSeq(new Integer(gxpw).toString());
    				}else {
    					schoolMajorYearAdmission2020.setSeqGrade(new Integer(qgj2020).toString());
    					schoolMajorYearAdmission2020.setSeq(new Integer(qgpw).toString());
    				}
    				
    				
    				//设置分数线
    				if("物理".equals(memberQuery.getSxkm())) {
    					schoolMajorYearAdmission2020.setGradeLine(new Integer(gradeLineLg2020).toString());
    				}
    				if("历史".equals(memberQuery.getSxkm())) {
    					schoolMajorYearAdmission2020.setGradeLine(new Integer(gradeLineWs2020).toString());
    				}
    				
    				
    				
    				if(zyadmission2020!=null&&zyadmission2020.getAvgGrade()!=null) {
    					schoolMajorYearAdmission2020.setAvgGradeStr(zyadmission2020.getAvgGrade().toString());
    					schoolMajorYearAdmission2020.setMinGradeStr(zyadmission2020.getLowGrade().toString());
                        schoolMajorYearAdmission2020.setAdmission(zyadmission2020.getAdmission());
    					zyavgGrade2020=zyadmission2020.getAvgGrade();
    					zyminGrade2020=zyadmission2020.getLowGrade();
    					
    					
    					
    					//计算平均分排位，最低分排位
    					int avgGrade2020Seq=99999999;
    					int lastSeq=1;
    					for(int m=0;m<hisPwGradeList.size();m++) {
    						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
    						if(hisGradeDoc.getYear().intValue()==yearNew3) {
    							
    							
    							int myGrade=hisGradeDoc.getGrade();
    							
    							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
    								if(hisGradeDoc.getUseIn().equals("广西")) {
    									int fencha=myGrade-zyavgGrade2020;
    									if(fencha==0) {
    										avgGrade2020Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										avgGrade2020Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    									
    								}
    							}else {
    								if(hisGradeDoc.getUseIn().equals("全国")) {
    									int fencha=myGrade-zyavgGrade2020;
    									if(fencha==0) {
    										avgGrade2020Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										avgGrade2020Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    								}
    							}
    							
    						}
    					}
    					
    					schoolMajorYearAdmission2020.setAvgGradeSeq(new Integer(avgGrade2020Seq).toString());
    					
    					
    					int minGrade2020Seq=99999999;
    					lastSeq=1;
    					for(int m=0;m<hisPwGradeList.size();m++) {
    						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
    						if(hisGradeDoc.getYear().intValue()==yearNew3) {
    							
    							
    							int myGrade=hisGradeDoc.getGrade();
    							
    							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
    								if(hisGradeDoc.getUseIn().equals("广西")) {
    									int fencha=myGrade-zyminGrade2020;
    									if(fencha==0) {
    										minGrade2020Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										minGrade2020Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    									
    								}
    							}else {
    								if(hisGradeDoc.getUseIn().equals("全国")) {
    									int fencha=myGrade-zyminGrade2020;
    									if(fencha==0) {
    										minGrade2020Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										minGrade2020Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    								}
    							}
    							
    						}
    					}
    					schoolMajorYearAdmission2020.setMinGradeSeq(new Integer(minGrade2020Seq).toString());
    					
    					
    					
    					
    				}else {
    					schoolMajorYearAdmission2020.setAvgGradeStr("-");
    					schoolMajorYearAdmission2020.setMinGradeStr("-");
    					
    					schoolMajorYearAdmission2020.setAvgGradeSeq("-");
    					schoolMajorYearAdmission2020.setMinGradeSeq("-");
    				}
    				if(zyadmission2020!=null&&zyadmission2020.getPlan()!=null) {
    				
	    				zyplan2020=zyadmission2020.getPlan();
						schoolMajorYearAdmission2020.setMajorPlan(zyplan2020);
						if(zyadmission2020.getSubmit()!=null) {
							zysubmit2020=zyadmission2020.getSubmit();
						}
						if(zyadmission2020.getAdmission()!=null) {
							zyadm2020=zyadmission2020.getAdmission();
						}
						schoolMajorYearAdmission2020.setPlanSubmitAdmission(plan2020+"-"+adm2020);
    				}
    				
    				//开始计算投档概率

    				/****
    				 * 专科的录取概率计算
    				 * 2024年的分数为a，2023年的院校录取最低分为b,a-b除2—再加50%等于院校专业组投档概率。2024年的分数为c，2023年的专业录取最低分为d,c-d除2—再加50%等于院校专业录取概率。
    				 */
    				if(provinceName.equals("广西")) {//广西学校
    					int userGrade=memberQuery.getGxgrade();
    					double rate=(userGrade-zyminGrade2022)/2+50;
    					if(rate>=100) rate=99.99;
						if(rate<1) rate=1;
						schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
						schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
						schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
    				}else {//全国学校
    					if(qgjfFlag) {//认可加分
    						int userGrade=memberQuery.getQggrade();
        					double rate=(userGrade-zyminGrade2022)/2+50;
        					if(rate>=100) rate=99.99;
							if(rate<1) rate=1;
							schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
							schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
							schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
    					}else {
    						int userGrade=memberQuery.getGrade();
        					double rate=(userGrade-zyminGrade2022)/2+50;
        					if(rate>=100) rate=99.99;
							if(rate<1) rate=1;
							schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
							schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
							schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
    					}
    					
    				}
    				
    				
    				
    				
    				
    				if(schoolMajorYearAdmission2022.getSubmitRate()==null) {
    					schoolMajorYearAdmission2022.setSubmitRate("-");
    				}
    				
    				if(schoolMajorYearAdmission2022.getPlanSubmitAdmission()==null) {
    					schoolMajorYearAdmission2022.setPlanSubmitAdmission("-");
    				}
    				
    				if(schoolMajorYearAdmission2022.getAvgGradeSeq()==null||schoolMajorYearAdmission2022.getAvgGradeSeq().equals("99999999")) {
    					schoolMajorYearAdmission2022.setAvgGradeSeq("-");
    				}
    				
    				if(schoolMajorYearAdmission2022.getMinGradeSeq()==null||schoolMajorYearAdmission2022.getMinGradeSeq().equals("99999999")) {
    					schoolMajorYearAdmission2022.setMinGradeSeq("-");
    				}
    				
    				if(schoolMajorYearAdmission2021.getSubmitRate()==null) {
    					schoolMajorYearAdmission2021.setSubmitRate("-");
    					
    				}
    				if(schoolMajorYearAdmission2021.getPlanSubmitAdmission()==null) {
    					schoolMajorYearAdmission2021.setPlanSubmitAdmission("-");
    				}
    				
    				
    				if(schoolMajorYearAdmission2021.getAvgGradeSeq()==null||schoolMajorYearAdmission2021.getAvgGradeSeq().equals("99999999")) {
    					schoolMajorYearAdmission2021.setAvgGradeSeq("-");
    				}
    				
    				if(schoolMajorYearAdmission2021.getMinGradeSeq()==null||schoolMajorYearAdmission2021.getMinGradeSeq().equals("99999999")) {
    					schoolMajorYearAdmission2021.setMinGradeSeq("-");
    				}
    				
    				if(schoolMajorYearAdmission2020.getSubmitRate()==null) {
    					schoolMajorYearAdmission2020.setSubmitRate("-");
    				}
    				if(schoolMajorYearAdmission2020.getPlanSubmitAdmission()==null) {
    					schoolMajorYearAdmission2020.setPlanSubmitAdmission("-");
    				}
    				
    				if(schoolMajorYearAdmission2022.getMajorPlan()==null) {
    					schoolMajorYearAdmission2022.setMajorPlan(9999);
						schoolMajorYearAdmission2022.setMajorPlanStr("-");
					}else{
						schoolMajorYearAdmission2022.setMajorPlanStr(schoolMajorYearAdmission2022.getMajorPlan().toString());
					}
    				
    				if(schoolMajorYearAdmission2021.getMajorPlan()==null) {
    					schoolMajorYearAdmission2021.setMajorPlan(9999);
						schoolMajorYearAdmission2021.setMajorPlanStr("-");
					}else{
						schoolMajorYearAdmission2021.setMajorPlanStr(schoolMajorYearAdmission2021.getMajorPlan().toString());
					}
    				
    				if(schoolMajorYearAdmission2020.getMajorPlan()==null) {
    					schoolMajorYearAdmission2020.setMajorPlan(9999);
						schoolMajorYearAdmission2020.setMajorPlanStr("-");
					}else{
						schoolMajorYearAdmission2020.setMajorPlanStr(schoolMajorYearAdmission2020.getMajorPlan().toString());
					}
    				
    				if(schoolMajorYearAdmission2020.getAvgGradeSeq()==null||schoolMajorYearAdmission2020.getAvgGradeSeq().equals("99999999")) {
    					schoolMajorYearAdmission2020.setAvgGradeSeq("-");
    				}
    				
    				if(schoolMajorYearAdmission2020.getMinGradeSeq()==null||schoolMajorYearAdmission2020.getMinGradeSeq().equals("99999999")) {
    					schoolMajorYearAdmission2020.setMinGradeSeq("-");
    				}
    				
    				zyList.add(schoolMajorYearAdmission2022);
    				zyList.add(schoolMajorYearAdmission2021);
    				zyList.add(schoolMajorYearAdmission2020);
    				
    				map.put("zyList", zyList);
    				
    				
    				
    				
    				
	        		
	        	}
	        	
	        	
	        	
	        	
	        	
	        	
	        	
        	}
        	
        	
        }else {
        	return AjaxResult.error("找不到学校信息");
        }
    	
    	
    	return AjaxResult.success(map);
    }
    
    
    /************
     * 
     * @param schoolCode
     * @param fxTypes
     * @param userId
     * @return
     * 返回内容为：
     * 1个school对象
     * 1个专业组数组
     * 第一个专业组的投档概率（3条记录）
     * 第一个专业组下个专业的投档概率（每个专业3条记录）
     */
    @ApiOperation("综合分析详情")
    @GetMapping("/zhfx_detail_h5")
    public AjaxResult zhfx_detail_h5(String schoolCode,String zyz,String fxTypes,String userId)
    {
    	
    	if(userId==null||userId.equals("")) {
    		return AjaxResult.error("请先登录");
    	}
    	
    	if(isSpecialChar(userId.toString())||sqlValidate(userId.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	BuzMember memberQuery=buzMemberService.selectBuzMemberById(userId);

    	if(memberQuery!=null&&memberQuery.getPhone()!=null) {
    		
    	}else {
    		
    		return AjaxResult.error("会员信息不存在，请先注册成为会员");
    	}
    	
    	if(memberQuery.getSfvip().intValue()==0) {
        	return AjaxResult.error("系统已更新，非会员不能查询");
        }
    	
    	if(schoolCode==null||schoolCode.trim().equals("")) {
    		
    		return AjaxResult.error("请选择学校");
    	}
    	
    	if(isSpecialChar(schoolCode.toString())||sqlValidate(schoolCode.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	if(zyz==null||zyz.trim().equals("")) {
    		
    		return AjaxResult.error("请选择专业组");
    	}
    	
    	if(isSpecialChar(zyz.toString())||sqlValidate(zyz.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	
    	Map map=new HashMap();
    	
    	map.put("member", memberQuery);
    	
    	
    	School schoolQuery=new School();
        
        
        if("物理".equals(memberQuery.getSxkm())) {
        	schoolQuery.setMajorType("理工类");
    	}
    	if("历史".equals(memberQuery.getSxkm())) {
    		schoolQuery.setMajorType("文史类");
    	}
    	
    	
    	//如果会员不是少数民族，则不能查询民族班
    	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
    		schoolQuery.setSsmzFlag(0);
    	}
    	
    	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
    		schoolQuery.setGjzxFlag(0);
    	}
    	
    	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
    		schoolQuery.setGxzxFlag(0);
    	}
    	
    	//考生的再选科目
    	schoolQuery.setZxkm(memberQuery.getZxkm());   
        
    	schoolQuery.setScode(schoolCode);
                
        int pageRow=0;
        
        schoolQuery.setPageNum(pageRow);
        
        
        List<SysDictData> dataList = dictTypeService.selectDictDataByType("school_level");
        
        
        List<School> list = schoolService.selectSchoolList4Page(schoolQuery);
        if(list!=null&&list.size()>0) {
        	School school=list.get(0);
        	String collegeLevel=school.getCollegeLevel();
        	if(collegeLevel!=null&&!collegeLevel.trim().equals("")) {
        		String collegeLevelStr="";
        		String[] collegeLevelArr= collegeLevel.split(",");
        		for(int i=0;i<dataList.size();i++) {
        			SysDictData data= dataList.get(i);
        			for(int j=0;j<collegeLevelArr.length;j++) {
        				if(data.getDictValue().equals(collegeLevelArr[j])) {
        					collegeLevelStr=collegeLevelStr+"<span>"+data.getDictLabel()+"</span>";
        				}
        			}
        		}
        		
        		school.setCollegeLevel(collegeLevelStr);
        	}
        	map.put("school", school);
        	
        	
        	boolean qgjfFlag=true;//是否认可全国加分
        	if(school.getRemark()!=null) {
        		if(school.getRemark().indexOf("不认可加分")>-1) {//该学校不认可加分，则全国分只取高考分
        			qgjfFlag=false;
        		}
        	}
        	
        	String provinceName=school.getProvinceName();
        	
        	
        	schoolCode="'"+schoolCode+"'";
        	
        	//查询专业组
        	SchoolPlan schoolPlanQuery=new SchoolPlan();
        	schoolPlanQuery.setYear(thisYear);
        	schoolPlanQuery.setSchoolCode(schoolCode);
        	if("物理".equals(memberQuery.getSxkm())) {
        		schoolPlanQuery.setMajorType("理工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		schoolPlanQuery.setMajorType("文史类");
        	}
        	
        	
        	//如果会员不是少数民族，则不能查询民族班
        	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
        		schoolPlanQuery.setSsmzFlag(0);
        	}
        	
        	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
        		schoolPlanQuery.setGjzxFlag(0);
        	}
        	
        	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
        		schoolPlanQuery.setGxzxFlag(0);
        	}
        	
        	schoolPlanQuery.setZyz(zyz);       	
        	//考生的再选科目
        	schoolPlanQuery.setZxkm(memberQuery.getZxkm());
        	
        	//List<SchoolPlan> zyzList =schoolPlanService.selectSchoolZyzList(schoolPlanQuery);
        	
        	List<SchoolPlan> zyzList =schoolPlanService.selectSchoolZyzPlanList(schoolPlanQuery);
        	
        	map.put("zyzList", zyzList);
        	
        	
        	List<SchoolPlan> plans2023List =schoolPlanService.selectSchoolZyz2023PlanList(schoolPlanQuery);

			List<SchoolPlan> plans2024List =schoolPlanService.selectSchoolZyz2024PlanList(schoolPlanQuery);
        	
        	
        	//查询各个专业组近3年的平均分、最低分（当前计算，先以2020,2021,2022这3年的录取数据为模拟数据）
        	SchoolMajorYearAdmission schoolMajorYearAdmission=new SchoolMajorYearAdmission();
        	schoolMajorYearAdmission.setYear(thisYear);
        	schoolMajorYearAdmission.setsCode(schoolCode);
        	if("物理".equals(memberQuery.getSxkm())) {
        		schoolMajorYearAdmission.setMajorType("理工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		schoolMajorYearAdmission.setMajorType("文史类");
        	}
        	
        	//如果会员不是少数民族，则不能查询民族班
        	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
        		schoolMajorYearAdmission.setSsmzFlag(0);
        	}
        	
        	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
        		schoolMajorYearAdmission.setGjzxFlag(0);
        	}
        	
        	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
        		schoolMajorYearAdmission.setGxzxFlag(0);
        	}
        	
        	//考生的再选科目
        	schoolMajorYearAdmission.setZxkm(memberQuery.getZxkm());
        	
        	schoolMajorYearAdmission.setZyz(zyz);
        	
        	List<SchoolMajorYearAdmission> zyzGradeList=schoolMajorYearAdmissionService.selectSchoolZyzYearAdmissionList(schoolMajorYearAdmission);
        	
        	//查询当年考生的排位(先用2023年的一分一档)，拿到2023年该分数的排位，取出2022、2021、2020年的同位分
        	int gxpw=99999999;
        	int qgpw=99999999;
        	//int qgjfpw=99999999;//全国加分的排位
        	//广西排位分
        	GkGradeDoc gkGradeDoc=new GkGradeDoc();
        	gkGradeDoc.setGrade(memberQuery.getGxgrade());
        	gkGradeDoc.setYear(gradeLineYear);
        	if("物理".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("史类");
        	}
        	List<GkGradeDoc> gradeList=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);
        	
        	for(int i=0;i<gradeList.size();i++) {
        		GkGradeDoc gradeDoc=gradeList.get(i);
        		if(gradeDoc.getUseIn().equals("广西")) {
        			gxpw=gradeDoc.getSeq();
        		}
        		/*
        		if(gradeDoc.getUseIn().equals("全国")) {
        			qgpw=gradeDoc.getSeq();
        		}
        		*/
        	}
        	
        	//全国不加分排位分
        	gkGradeDoc=new GkGradeDoc();
        	if(qgjfFlag) {//认可全国加分
        		gkGradeDoc.setGrade(memberQuery.getQggrade());
        	}else {//不认可全国加分
        		gkGradeDoc.setGrade(memberQuery.getGrade());
        	}
        	gkGradeDoc.setYear(2024);
        	if("物理".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("史类");
        	}
        	List<GkGradeDoc> gradeList2=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);
        	
        	for(int i=0;i<gradeList2.size();i++) {
        		GkGradeDoc gradeDoc=gradeList2.get(i);
        		
        		if(gradeDoc.getUseIn().equals("全国")) {
        			qgpw=gradeDoc.getSeq();
        		}
        		
        	}
        	
        	
        	
        	//查找近3年的广西同位分
        	gkGradeDoc=new GkGradeDoc();
        	if("物理".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("史类");
        	}
        	gkGradeDoc.setUseIn("广西");
        	gkGradeDoc.setSeq(gxpw);
        	List<GkGradeDoc> gxpwGradeList=gkGradeDocService.selectGkGradeDocListBySeq(gkGradeDoc);
        	int gxj2022=0;
        	int gxj2021=0;
        	int gxj2020=0;
        	for(int i=0;i<gxpwGradeList.size();i++) {
        		GkGradeDoc gxGradeDoc=gxpwGradeList.get(i);
        		if(gxGradeDoc.getYear().intValue()==yearNew1) {
        			gxj2022=gxGradeDoc.getGrade();
        		}
        		if(gxGradeDoc.getYear().intValue()==yearNew2) {
        			gxj2021=gxGradeDoc.getGrade();
        		}
        		if(gxGradeDoc.getYear().intValue()==yearNew3) {
        			gxj2020=gxGradeDoc.getGrade();
        		}
        	}
        	
        	//查找进3年的全国不加分同位分
        	gkGradeDoc=new GkGradeDoc();
        	if("物理".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("史类");
        	}
        	gkGradeDoc.setUseIn("全国");
        	gkGradeDoc.setSeq(qgpw);
        	List<GkGradeDoc> qgpwGradeList=gkGradeDocService.selectGkGradeDocListBySeq(gkGradeDoc);
        	int qgj2022=0;
        	int qgj2021=0;
        	int qgj2020=0;
        	for(int i=0;i<qgpwGradeList.size();i++) {
        		GkGradeDoc gxGradeDoc=qgpwGradeList.get(i);
        		if(gxGradeDoc.getYear().intValue()==yearNew1) {
        			qgj2022=gxGradeDoc.getGrade();
        		}
        		if(gxGradeDoc.getYear().intValue()==yearNew2) {
        			qgj2021=gxGradeDoc.getGrade();
        		}
        		if(gxGradeDoc.getYear().intValue()==yearNew3) {
        			qgj2020=gxGradeDoc.getGrade();
        		}
        	}
        	
        	
        	
        	/*
        	//查找进3年的全国加分同位分
        	gkGradeDoc=new GkGradeDoc();
        	if("物理".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("史类");
        	}
        	gkGradeDoc.setUseIn("全国");
        	gkGradeDoc.setSeq(qgjfpw);
        	List<GkGradeDoc> qgjfpwGradeList=gkGradeDocService.selectGkGradeDocListBySeq(gkGradeDoc);
        	int qgjfj2022=0;//近3年全国不加分的排位分
        	int qgjfj2021=0;
        	int qgjfj2020=0;
        	for(int i=0;i<qgjfpwGradeList.size();i++) {
        		GkGradeDoc gxGradeDoc=qgjfpwGradeList.get(i);
        		if(gxGradeDoc.getYear().intValue()==2022) {
        			qgjfj2022=gxGradeDoc.getGrade();
        		}
        		if(gxGradeDoc.getYear().intValue()==2021) {
        			qgjfj2021=gxGradeDoc.getGrade();
        		}
        		if(gxGradeDoc.getYear().intValue()==2020) {
        			qgjfj2020=gxGradeDoc.getGrade();
        		}
        	}
        	*/
        	
        	
        	//查询历年一分一档，用于计算平均分排位和最低分排位
        	GkGradeDoc hisGkGradeDoc=new GkGradeDoc();
        	if("物理".equals(memberQuery.getSxkm())) {
        		hisGkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		hisGkGradeDoc.setGradeClass("史类");
        	}
        	
        	List<GkGradeDoc> hisPwGradeList=gkGradeDocService.selectGkGradeDocList(hisGkGradeDoc);
        	
        	
        	
        	//专业组投档概率
        	List<School> returnList =new ArrayList();
        	
        	
        	DecimalFormat df = new DecimalFormat("#.00");
        	//开始计算专业组投档率
        	if(zyzList!=null&&zyzList.size()>0) {
        		SchoolPlan zyzPlan=zyzList.get(0);//取出该学校第一个专业组
        		
        		
        		
        		//String zyz=zyzPlan.getZyz();
				
				
				int avgGrade2022=0;
				int minGrade2022=0;
				int avgGrade2021=0;
				int minGrade2021=0;
				int avgGrade2020=0;
				int minGrade2020=0;
				
				//历史招生数量，从指南取
				int plan2022=0;
				int submit2022=0;
				int adm2022=0;
				int plan2021=0;
				int submit2021=0;
				int adm2021=0;
				int plan2020=0;
				int submit2020=0;
				int adm2020=0;
				
				//当年招生数量，从招生计划取
				int plan2023=0;
				
				School schoolRecord2022=new School();
				schoolRecord2022.setProvinceName(provinceName);
				schoolRecord2022.setSname(school.getSname());
				schoolRecord2022.setScode(school.getScode());
				schoolRecord2022.setZyz(zyz);
				schoolRecord2022.setZxkm(zyzPlan.getKm2());
				schoolRecord2022.setYear(yearNew1);
				schoolRecord2022.setSranking(school.getSranking());
				
				if(provinceName.equals("广西")) {
					schoolRecord2022.setSeqGrade(new Integer(gxj2022).toString());
					schoolRecord2022.setSeq(new Integer(gxpw).toString());
				}else {
					schoolRecord2022.setSeqGrade(new Integer(qgj2022).toString());
					schoolRecord2022.setSeq(new Integer(qgpw).toString());
				}
				
				
				//设置分数线
				if("物理".equals(memberQuery.getSxkm())) {
					schoolRecord2022.setGradeLine(new Integer(gradeLineLg2022).toString());
				}
				if("历史".equals(memberQuery.getSxkm())) {
					schoolRecord2022.setGradeLine(new Integer(gradeLineWs2022).toString());
				}
				
				SchoolMajorYearAdmission admission2022=null;
				SchoolMajorYearAdmission admission2021=null;
				SchoolMajorYearAdmission admission2020=null;
				for(int j=0;j<zyzGradeList.size();j++) {
					SchoolMajorYearAdmission admission=zyzGradeList.get(j);
					String zyzAdmin=admission.getZyz();
					
					if(zyz.equals(zyzAdmin)&&admission.getsCode().equals(zyzPlan.getSchoolCode())) {//同一个学校的专业组        						
						if(admission.getYear()==yearNew1) {
							admission2022=admission;
						}
						if(admission.getYear()==yearNew2) {
							admission2021=admission;
						}
						if(admission.getYear()==yearNew3) {
							admission2020=admission;
						}
					}
				}
				if(admission2022!=null&&admission2022.getAvgGrade()!=null) {
					schoolRecord2022.setAvgGrade(admission2022.getAvgGrade().toString());
					schoolRecord2022.setMinGrade(admission2022.getLowGrade().toString());
					avgGrade2022=admission2022.getAvgGrade();
					minGrade2022=admission2022.getLowGrade();
					
					
					
					
					//计算平均分排位，最低分排位
					int avgGrade2022Seq=99999999;
					int lastSeq=1;
					for(int m=0;m<hisPwGradeList.size();m++) {
						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
						if(hisGradeDoc.getYear().intValue()==yearNew1) {
							
							
							int myGrade=hisGradeDoc.getGrade();
							
							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
								if(hisGradeDoc.getUseIn().equals("广西")) {
									int fencha=myGrade-avgGrade2022;
									if(fencha==0) {
										avgGrade2022Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										avgGrade2022Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
									
								}
							}else {
								if(hisGradeDoc.getUseIn().equals("全国")) {
									int fencha=myGrade-avgGrade2022;
									if(fencha==0) {
										avgGrade2022Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										avgGrade2022Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
								}
							}
							
						}
					}
					
					schoolRecord2022.setAvgGradeSeq(new Integer(avgGrade2022Seq).toString());
					
					
					int minGrade2022Seq=99999999;
					lastSeq=1;
					for(int m=0;m<hisPwGradeList.size();m++) {
						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
						if(hisGradeDoc.getYear().intValue()==yearNew1) {
							
							
							int myGrade=hisGradeDoc.getGrade();
							
							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
								if(hisGradeDoc.getUseIn().equals("广西")) {
									int fencha=myGrade-minGrade2022;
									if(fencha==0) {
										minGrade2022Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										minGrade2022Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
									
								}
							}else {
								if(hisGradeDoc.getUseIn().equals("全国")) {
									int fencha=myGrade-minGrade2022;
									if(fencha==0) {
										minGrade2022Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										minGrade2022Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
								}
							}
							
						}
					}

					schoolRecord2022.setMinGradeSeq(new Integer(minGrade2022Seq).toString());
					
					
					
					
					
					
					
				}else {
					schoolRecord2022.setAvgGrade("-");
					schoolRecord2022.setMinGrade("-");
					schoolRecord2022.setAvgGradeSeq("-");
					schoolRecord2022.setMinGradeSeq("-");
				}
				
				if(admission2022!=null) {
					plan2022=admission2022.getPlan();
					
					if(admission2022.getSubmit()!=null) {
						submit2022=admission2022.getSubmit();
					}
					adm2022=admission2022.getAdmission();
					schoolRecord2022.setPlanSubmitAdmission(plan2022+"-"+adm2022);
					}
				
				
				for(int j=0;j<plans2023List.size();j++) {
					SchoolPlan schoolPlan2023=plans2023List.get(j);
					if(zyz.equals(schoolPlan2023.getZyz())&&zyzPlan.getSchoolCode().equals(schoolPlan2023.getSchoolCode())) {//同一个学校的专业组        	
						plan2023=schoolPlan2023.getMajorPlan();
					}
				}
        		
        		
        		
				School schoolRecord2021=new School();
				schoolRecord2021.setProvinceName(provinceName);
				schoolRecord2021.setSname(school.getSname());
				schoolRecord2021.setScode(school.getScode());
				schoolRecord2021.setZyz(zyz);
				schoolRecord2021.setZxkm(zyzPlan.getKm2());
				schoolRecord2021.setYear(yearNew2);
				schoolRecord2021.setSranking(school.getSranking());
				
				if(provinceName.equals("广西")) {
					schoolRecord2021.setSeqGrade(new Integer(gxj2021).toString());
					schoolRecord2021.setSeq(new Integer(gxpw).toString());
				}else {
					schoolRecord2021.setSeqGrade(new Integer(qgj2021).toString());
					schoolRecord2021.setSeq(new Integer(qgpw).toString());
				}
				
				
				//设置分数线
				if("物理".equals(memberQuery.getSxkm())) {
					schoolRecord2021.setGradeLine(new Integer(gradeLineLg2021).toString());
				}
				if("历史".equals(memberQuery.getSxkm())) {
					schoolRecord2021.setGradeLine(new Integer(gradeLineWs2021).toString());
				}
				
				if(admission2021!=null&&admission2021.getAvgGrade()!=null) {
					schoolRecord2021.setAvgGrade(admission2021.getAvgGrade().toString());
					schoolRecord2021.setMinGrade(admission2021.getLowGrade().toString());
					avgGrade2021=admission2021.getAvgGrade();
					minGrade2021=admission2021.getLowGrade();
					
					
					
					
					//计算平均分排位，最低分排位
					int avgGrade2021Seq=99999999;
					int lastSeq=1;
					for(int m=0;m<hisPwGradeList.size();m++) {
						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
						if(hisGradeDoc.getYear().intValue()==yearNew2) {
							
							
							int myGrade=hisGradeDoc.getGrade();
							
							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
								if(hisGradeDoc.getUseIn().equals("广西")) {
									int fencha=myGrade-avgGrade2021;
									if(fencha==0) {
										avgGrade2021Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										avgGrade2021Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
									
								}
							}else {
								if(hisGradeDoc.getUseIn().equals("全国")) {
									int fencha=myGrade-avgGrade2021;
									if(fencha==0) {
										avgGrade2021Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										avgGrade2021Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
								}
							}
							
						}
					}
					
					schoolRecord2021.setAvgGradeSeq(new Integer(avgGrade2021Seq).toString());
					
					
					int minGrade2021Seq=99999999;
					lastSeq=1;
					for(int m=0;m<hisPwGradeList.size();m++) {
						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
						if(hisGradeDoc.getYear().intValue()==yearNew2) {
							
							
							int myGrade=hisGradeDoc.getGrade();
							
							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
								if(hisGradeDoc.getUseIn().equals("广西")) {
									int fencha=myGrade-minGrade2021;
									if(fencha==0) {
										minGrade2021Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										minGrade2021Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
									
								}
							}else {
								if(hisGradeDoc.getUseIn().equals("全国")) {
									int fencha=myGrade-minGrade2021;
									if(fencha==0) {
										minGrade2021Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										minGrade2021Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
								}
							}
							
						}
					}
					
					schoolRecord2021.setMinGradeSeq(new Integer(minGrade2021Seq).toString());
					
					
					
					
					
					
				}else {
					schoolRecord2021.setAvgGrade("-");
					schoolRecord2021.setMinGrade("-");
					schoolRecord2021.setAvgGradeSeq("-");
					schoolRecord2021.setMinGradeSeq("-");
				}
				if(admission2021!=null) {
					plan2021=admission2021.getPlan();
					if(admission2021.getSubmit()!=null) {
						submit2021=admission2021.getSubmit();
					}
					adm2021=admission2021.getAdmission();
					schoolRecord2021.setPlanSubmitAdmission(plan2021+"-"+adm2021);
				}
				
				
				School schoolRecord2020=new School();
				schoolRecord2020.setProvinceName(provinceName);
				schoolRecord2020.setSname(school.getSname());
				schoolRecord2020.setScode(school.getScode());
				schoolRecord2020.setZyz(zyz);
				schoolRecord2020.setZxkm(zyzPlan.getKm2());
				schoolRecord2020.setYear(yearNew3);
				schoolRecord2020.setSranking(school.getSranking());
				
				if(provinceName.equals("广西")) {
					schoolRecord2020.setSeqGrade(new Integer(gxj2020).toString());
					schoolRecord2020.setSeq(new Integer(gxpw).toString());
				}else {
					schoolRecord2020.setSeqGrade(new Integer(qgj2020).toString());
					schoolRecord2020.setSeq(new Integer(qgpw).toString());
				}
				
				
				//设置分数线
				if("物理".equals(memberQuery.getSxkm())) {
					schoolRecord2020.setGradeLine(new Integer(gradeLineLg2020).toString());
				}
				if("历史".equals(memberQuery.getSxkm())) {
					schoolRecord2020.setGradeLine(new Integer(gradeLineWs2020).toString());
				}
				
				if(admission2020!=null&&admission2020.getAvgGrade()!=null) {
					schoolRecord2020.setAvgGrade(admission2020.getAvgGrade().toString());
					schoolRecord2020.setMinGrade(admission2020.getLowGrade().toString());
					avgGrade2020=admission2020.getAvgGrade();
					minGrade2020=admission2020.getLowGrade();        		
					
					
					
					
					//计算平均分排位，最低分排位
					int avgGrade2020Seq=99999999;
					int lastSeq=1;
					for(int m=0;m<hisPwGradeList.size();m++) {
						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
						if(hisGradeDoc.getYear().intValue()==yearNew3) {
							
							
							int myGrade=hisGradeDoc.getGrade();
							
							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
								if(hisGradeDoc.getUseIn().equals("广西")) {
									int fencha=myGrade-avgGrade2020;
									if(fencha==0) {
										avgGrade2020Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										avgGrade2020Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
									
								}
							}else {
								if(hisGradeDoc.getUseIn().equals("全国")) {
									int fencha=myGrade-avgGrade2020;
									if(fencha==0) {
										avgGrade2020Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										avgGrade2020Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
								}
							}
							
						}
					}
					
					schoolRecord2020.setAvgGradeSeq(new Integer(avgGrade2020Seq).toString());
					
					
					int minGrade2020Seq=99999999;
					lastSeq=1;
					for(int m=0;m<hisPwGradeList.size();m++) {
						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
						if(hisGradeDoc.getYear().intValue()==yearNew3) {
							
							
							int myGrade=hisGradeDoc.getGrade();
							
							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
								if(hisGradeDoc.getUseIn().equals("广西")) {
									int fencha=myGrade-minGrade2020;
									if(fencha==0) {
										minGrade2020Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										minGrade2020Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
									
								}
							}else {
								if(hisGradeDoc.getUseIn().equals("全国")) {
									int fencha=myGrade-minGrade2020;
									if(fencha==0) {
										minGrade2020Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										minGrade2020Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
								}
							}
							
						}
					}
					
					schoolRecord2020.setMinGradeSeq(new Integer(minGrade2020Seq).toString());
					
					
					
					
					
					
					
				}else {
					schoolRecord2020.setAvgGrade("-");
					schoolRecord2020.setMinGrade("-");
					schoolRecord2020.setAvgGradeSeq("-");
					schoolRecord2020.setMinGradeSeq("-");
				}
				if(admission2020!=null) {
					plan2020=admission2020.getPlan();
					if(admission2020.getSubmit()!=null) {
						submit2020=admission2020.getSubmit();
					}
					adm2020=admission2020.getAdmission();
					schoolRecord2020.setPlanSubmitAdmission(plan2020+"-"+adm2020);
					}
				
				//开始计算投档概率
				/*
				 *   专业组投档概率计算
				 * 
				 * 1.  3年的同位分都比录取平均分高，则(2022年同位分-2022年平均分)*55%+(2021年同位分-2021年平均分)*30%+(2020年同位分-2020年平均分)*15%
				 * 
				 *     3年的同位分都比录取平均分高，则((2022年同位分-2022年平均分)/2+85%)*55%+((2021年同位分-2021年平均分)/2+85%)*30%+((2020年同位分-2020年平均分)/2+85%)*15%
				 *     
				 *     有2年高于平均分（1年低于平均分），则((2022年高于的同位分-2022年平均分)/2+75%)*55%+((2021年高于的同位分-2021年平均分)/2+75%)*30%+((2020高于年同位分-2020年平均分)/2+75%)*15%
				 *                                     ((2022年低于的同位分-2022年最低分)/2+55%)*55%+((2021年低于的同位分-2021年最低分)/2+55%)*30%+((2020低于年同位分-2020年最低分)/2+55%)*15%
				 *                                     
				 *     有1年高于平均分（2年低于平均分），则((2022年高于的同位分-2022年平均分)/2+65%)*55%+((2021年高于的同位分-2021年平均分)/2+65%)*30%+((2020高于年同位分-2020年平均分)/2+65%)*15%
				 *                                     ((2022年低于的同位分-2022年最低分)/2+55%)*55%+((2021年低于的同位分-2021年最低分)/2+55%)*30%+((2020低于年同位分-2020年最低分)/2+55%)*15%
				 *     
				 * 
				 * 2.  3年都低于平均分的，则((2022年同位分-2022年录取最低分)/2+50%)*55%+((2021年同位分-2021年录取最低分)/2+50%)*30%+((2020年同位分-2020年录取最低分)/2+50%)*15%
				 * 
				 * 3.  如果数据不满3年，只有2年，则剩下的两年各乘50%。只有一年的录取数据的，乘100%。
				 * 
				 * 
				 * 招生数量对比占的概率
				 * 1.当年招生数量，H是当年的招生数量，I是去年的招生数量
				 * H＜=20，（H-I）%=h
                   20＜=H＜50,（H-I）×0.5%=h。
                   50＜H＜100,（H-I）×0.3%=h。
                   100＜H,（H-I）×0.1%=h。
                   h最大只能是30%
                  
                  //目前的数据，投档数都是0，所以下面的内容暂时不算了 
                  2. I是去年的招生数量，L是去年的专业投档数 ；J是前年的招生数量，M是前年的专业投档数；K是大前年的招生数量，N是大前年的专业投档数
                  I-L为正数，增加5%概率，以i代替。
                  J-M为正数，增加5%概率，以j代替。
                  K-N为正数，增加5%概率，以k代替。
                  
                  
                  
                  
                  专业投档概率计算
                  如果2023年招生人数<2022年招生人数，则(((2022年同位分-（2023年人数）的名次录取分))/2+50%)*55%   否则如果2023年招生人数>2022年招生人数,则((2022年同位分-（2022录取人数的最后一名的录取分)/2+50%)*55%，
                  如果2023年招生人数<2021年招生人数，则(2021年同位分-（2023年人数）的名次录取分))/2+50%)*30%+  否则如果2023年招生人数>2021年招生人数,则((2021年同位分-（2021录取人数的最后一名的录取分)/2+50%)*30%，
                  如果2023年招生人数<2020年招生人数，则(2020年同位分-（2023年人数）的名次录取分))/2+50%)*15%+  否则如果2023年招生人数>2020年招生人数,则((2020年同位分-（2020录取人数的最后一名的录取分)/2+50%)*15%，                           
                 
                         
				 * 
				 * 3.  如果数据不满3年，只有2年，则剩下的两年各乘60%,40%。只有一年的录取数据的，乘100%。
                  
                  
                 * 招生数量对比占的概率
				 * 1.当年招生数量，H是当年的招生数量，I是去年的招生数量
				 * H＜=20，（H-I）%=h
                   20＜=H＜50,（H-I）×0.5%=h。
                   50＜H＜100,（H-I）×0.3%=h。
                   100＜H,（H-I）×0.1%=h。
                   h最大只能是30%
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                  
                   
				 */
				
				if(avgGrade2020>0&&avgGrade2021>0&&avgGrade2022>0) {//3年都有数据
					if(provinceName.equals("广西")) {//广西学校，用广西同位分
						if(gxj2020-avgGrade2020>0 &&gxj2021-avgGrade2021>0 &&gxj2022-avgGrade2022>0) {//3年的同位分都比录取平均分高
							double rate=((gxj2022-avgGrade2022)/2+80)*0.55+((gxj2021-avgGrade2021)/2+80)*0.3+((gxj2020-avgGrade2020)/2+80)*0.15;
							
							/*
							 * * 招生数量对比占的概率
	        				 * 1.当年招生数量，H是当年的招生数量，I是去年的招生数量
	        				 * H＜20，（H-I）%=h
	                           20＜=H＜50,（H-I）×0.5%=h。
	                           50＜=H＜100,（H-I）×0.3%=h。
	                           100＜=H,（H-I）×0.1%=h。
	        							 */
							/*
							if(plan2023<10) {
								double rate2=plan2023-plan2022;
								if(rate2>30) rate2=30;
								if(rate2<-30) rate2=-30;
								rate=rate+rate2;
							}else if(plan2023>=10&&plan2023<50) {
								double rate2=(plan2023-plan2022)*0.5;
								if(rate2>30) rate2=30;
								if(rate2<-30) rate2=-30;
								rate=rate+rate2;
							}else if(plan2023>=50&&plan2023<100) {
								double rate2=(plan2023-plan2022)*0.3;
								if(rate2>30) rate2=30;
								if(rate2<-30) rate2=-30;
								rate=rate+rate2;
							}else if(plan2023>=100) {
								double rate2=(plan2023-plan2022)*0.1;
								if(rate2>30) rate2=30;
								if(rate2<-30) rate2=-30;
								rate=rate+rate2;
							}
							*/
							if(rate>=100) rate=99.99;
							if(rate<1) rate=1;
							schoolRecord2020.setSubmitRate(df.format(rate));
							schoolRecord2021.setSubmitRate(df.format(rate));
							schoolRecord2022.setSubmitRate(df.format(rate));
						}else {//不是3个
							double rate=0;
							//2年高于
							int count=0;
							if(gxj2022-avgGrade2022>0) {
								count++;
							}
							if(gxj2021-avgGrade2021>0) {
								count++;
							}
							if(gxj2020-avgGrade2020>0) {
								count++;
							}
							if(count==2) {//有2年高于同位分的
								
								if(gxj2022-avgGrade2022>0) {
									rate=rate+((gxj2022-avgGrade2022)/2+70)*0.55;
								}else {
									rate=rate+((gxj2022-minGrade2022)/2+50)*0.55;
								}
								
								if(gxj2021-avgGrade2021>0) {
									rate=rate+((gxj2021-avgGrade2021)/2+70)*0.3;
								}else {
									rate=rate+((gxj2021-minGrade2021)/2+50)*0.3;
								}
								
								if(gxj2020-avgGrade2020>0) {
									rate=rate+((gxj2020-avgGrade2020)/2+70)*0.15;
								}else {
									rate=rate+((gxj2020-minGrade2020)/2+50)*0.15;
								}
							}else if(count==1) {//有1年高于同位分的
								
								if(gxj2022-avgGrade2022>0) {
									rate=rate+((gxj2022-avgGrade2022)/2+60)*0.55;
								}else {
									rate=rate+((gxj2022-minGrade2022)/2+50)*0.55;
								}
								
								if(gxj2021-avgGrade2021>0) {
									rate=rate+((gxj2021-avgGrade2021)/2+60)*0.3;
								}else {
									rate=rate+((gxj2021-minGrade2021)/2+50)*0.3;
								}
								
								if(gxj2020-avgGrade2020>0) {
									rate=rate+((gxj2020-avgGrade2020)/2+60)*0.15;
								}else {
									rate=rate+((gxj2020-minGrade2020)/2+50)*0.15;
								}
								
							}else {//一个高于的都没有
								rate=((gxj2022-minGrade2022)/2+50)*0.55+((gxj2021-minGrade2021)/2+50)*0.3+((gxj2020-minGrade2020)/2+50)*0.15;
							}

							
							/*
							if(plan2023<10) {
								double rate2=plan2023-plan2022;
								if(rate2>30) rate2=30;
								if(rate2<-30) rate2=-30;
								rate=rate+rate2;
							}else if(plan2023>=10&&plan2023<50) {
								double rate2=(plan2023-plan2022)*0.5;
								if(rate2>30) rate2=30;
								if(rate2<-30) rate2=-30;
								rate=rate+rate2;
							}else if(plan2023>=50&&plan2023<100) {
								double rate2=(plan2023-plan2022)*0.3;
								if(rate2>30) rate2=30;
								if(rate2<-30) rate2=-30;
								rate=rate+rate2;
							}else if(plan2023>=100) {
								double rate2=(plan2023-plan2022)*0.1;
								if(rate2>30) rate2=30;
								if(rate2<-30) rate2=-30;
								rate=rate+rate2;
							}
							*/
							if(rate>=100) rate=99.99;
							if(rate<1) rate=1;
							schoolRecord2020.setSubmitRate(df.format(rate));
							schoolRecord2021.setSubmitRate(df.format(rate));
							schoolRecord2022.setSubmitRate(df.format(rate));        						
						}
					}else {//全国学校，用全国同位分
						if(qgj2020-avgGrade2020>0 &&qgj2021-avgGrade2021>0 &&qgj2022-avgGrade2022>0) {//3年的同位分都比录取平均分高
							double rate=((qgj2022-avgGrade2022)/2+80)*0.55+((qgj2021-avgGrade2021)/2+80)*0.3+((qgj2020-avgGrade2020)/2+80)*0.15;
							/*
							if(plan2023<10) {
								double rate2=plan2023-plan2022;
								if(rate2>30) rate2=30;
								if(rate2<-30) rate2=-30;
								rate=rate+rate2;
							}else if(plan2023>=10&&plan2023<50) {
								double rate2=(plan2023-plan2022)*0.5;
								if(rate2>30) rate2=30;
								if(rate2<-30) rate2=-30;
								rate=rate+rate2;
							}else if(plan2023>=50&&plan2023<100) {
								double rate2=(plan2023-plan2022)*0.3;
								if(rate2>30) rate2=30;
								if(rate2<-30) rate2=-30;
								rate=rate+rate2;
							}else if(plan2023>=100) {
								double rate2=(plan2023-plan2022)*0.1;
								if(rate2>30) rate2=30;
								if(rate2<-30) rate2=-30;
								rate=rate+rate2;
							}
							*/
							if(rate>=100) rate=99.99;
							if(rate<1) rate=1;
							schoolRecord2020.setSubmitRate(df.format(rate));
							schoolRecord2021.setSubmitRate(df.format(rate));
							schoolRecord2022.setSubmitRate(df.format(rate));
						}else {
							
							
							double rate=0;
							//2年高于
							int count=0;
							if(qgj2022-avgGrade2022>0) {
								count++;
							}
							if(qgj2021-avgGrade2021>0) {
								count++;
							}
							if(qgj2020-avgGrade2020>0) {
								count++;
							}
							if(count==2) {//有2年高于同位分的
								
								if(qgj2022-avgGrade2022>0) {
									rate=rate+((qgj2022-avgGrade2022)/2+70)*0.55;
								}else {
									rate=rate+((qgj2022-minGrade2022)/2+50)*0.55;
								}
								
								if(qgj2021-avgGrade2021>0) {
									rate=rate+((qgj2021-avgGrade2021)/2+70)*0.3;
								}else {
									rate=rate+((qgj2021-minGrade2021)/2+50)*0.3;
								}
								
								if(qgj2020-avgGrade2020>0) {
									rate=rate+((qgj2020-avgGrade2020)/2+70)*0.15;
								}else {
									rate=rate+((qgj2020-minGrade2020)/2+50)*0.15;
								}
							}else if(count==1) {//有1年高于同位分的
								
								if(qgj2022-avgGrade2022>0) {
									rate=rate+((qgj2022-avgGrade2022)/2+60)*0.55;
								}else {
									rate=rate+((qgj2022-minGrade2022)/2+50)*0.55;
								}
								
								if(qgj2021-avgGrade2021>0) {
									rate=rate+((qgj2021-avgGrade2021)/2+60)*0.3;
								}else {
									rate=rate+((qgj2021-minGrade2021)/2+50)*0.3;
								}
								
								if(qgj2020-avgGrade2020>0) {
									rate=rate+((qgj2020-avgGrade2020)/2+60)*0.15;
								}else {
									rate=rate+((qgj2020-minGrade2020)/2+50)*0.15;
								}
								
							}else {//一个高于的都没有
								rate=((qgj2022-minGrade2022)/2+50)*0.55+((qgj2021-minGrade2021)/2+50)*0.3+((qgj2020-minGrade2020)/2+50)*0.15;
							}
							
							/*
							if(plan2023<10) {
								double rate2=plan2023-plan2022;
								if(rate2>30) rate2=30;
								if(rate2<-30) rate2=-30;
								rate=rate+rate2;
							}else if(plan2023>=10&&plan2023<50) {
								double rate2=(plan2023-plan2022)*0.5;
								if(rate2>30) rate2=30;
								if(rate2<-30) rate2=-30;
								rate=rate+rate2;
							}else if(plan2023>=50&&plan2023<100) {
								double rate2=(plan2023-plan2022)*0.3;
								if(rate2>30) rate2=30;
								if(rate2<-30) rate2=-30;
								rate=rate+rate2;
							}else if(plan2023>=100) {
								double rate2=(plan2023-plan2022)*0.1;
								if(rate2>30) rate2=30;
								if(rate2<-30) rate2=-30;
								rate=rate+rate2;
							}
							*/
							if(rate>=100) rate=99.99;
							if(rate<1) rate=1;
							schoolRecord2020.setSubmitRate(df.format(rate));
							schoolRecord2021.setSubmitRate(df.format(rate));
							schoolRecord2022.setSubmitRate(df.format(rate));        						
						}
					}
				}else {//数据不满3年,3.  如果数据不满3年，只有2年，则剩下的两年各乘60%,40%。只有一年的录取数据的，乘100%。
					int years=0;
					if(avgGrade2020>0) years++;
					if(avgGrade2021>0) years++;
					if(avgGrade2022>0) years++;
					if(years==2) {
						
						
						
						double rate=0;
						if(provinceName.equals("广西")) {
							
							int heightYears=0;//这两年中，同位分大于平均分的年份数=2，则+70，如果年份数=1，则+60，都不大于平均分，则+50
    						if(avgGrade2022>0&&gxj2022-avgGrade2022>0) heightYears++;
    						if(avgGrade2021>0&&gxj2021-avgGrade2021>0) heightYears++;
    						if(avgGrade2020>0&&gxj2020-avgGrade2020>0) heightYears++;
							
							if(avgGrade2022>0) {//2022年有数据
								if(heightYears==2) {
									double rate1=((gxj2022-avgGrade2022)/2+70)*0.60;
    								rate=rate+rate1;
    								
    								if(avgGrade2021>0) {
        								double rate2=((gxj2021-avgGrade2021)/2+70)*0.40;
        								rate=rate+rate2;
        							}else {
        								double rate2=((gxj2020-avgGrade2020)/2+70)*0.40;
        								rate=rate+rate2;
        							}
								}else if(heightYears==1) {
									if(gxj2022-avgGrade2022>0) {
										double rate1=((gxj2022-avgGrade2022)/2+60)*0.60;
        								rate=rate+rate1;
									}else {
										double rate1=((gxj2022-minGrade2022)/2+50)*0.60;
        								rate=rate+rate1;
									}
									if(avgGrade2021>0) {
    									if(gxj2021-avgGrade2021>0) {
    										double rate1=((gxj2021-avgGrade2021)/2+60)*0.40;
            								rate=rate+rate1;
    									}else {
    										double rate1=((gxj2021-minGrade2021)/2+60)*0.40;
            								rate=rate+rate1;
    									}
									}else {
										if(gxj2020-avgGrade2020>0) {
    										double rate1=((gxj2020-avgGrade2020)/2+60)*0.40;
            								rate=rate+rate1;
    									}else {
    										double rate1=((gxj2020-minGrade2020)/2+60)*0.40;
            								rate=rate+rate1;
    									}
									}
								}else {//都不高于平均分
									double rate1=((gxj2022-minGrade2022)/2+50)*0.60;
    								rate=rate+rate1;
    								if(avgGrade2021>0) {
    									double rate2=((gxj2021-minGrade2021)/2+50)*0.60;
        								rate=rate+rate2;
    								}else {
    									double rate2=((gxj2020-minGrade2020)/2+50)*0.40;
        								rate=rate+rate2;
    								}
								}
							}else {//2022年没数据，只有2021和2020年数据
								if(heightYears==2) {
									double rate1=((gxj2021-avgGrade2021)/2+70)*0.60+((gxj2020-avgGrade2020)/2+70)*0.40;
									rate=rate+rate1;
								}else if(heightYears==1) {
									if(gxj2021-avgGrade2021>0) {
										double rate1=((gxj2021-avgGrade2021)/2+60)*0.60;
										rate=rate+rate1;
									}else {
										double rate1=((gxj2021-minGrade2021)/2+50)*0.60;
										rate=rate+rate1;
									}
									if(gxj2020-avgGrade2020>0) {
										double rate1=((gxj2020-avgGrade2020)/2+60)*0.40;
										rate=rate+rate1;
									}else {
										double rate1=((gxj2020-minGrade2020)/2+50)*0.40;
										rate=rate+rate1;
									}
								}else {
									double rate1=((gxj2021-minGrade2021)/2+50)*0.60;
    								rate=rate+rate1;
        							
    								double rate2=((gxj2020-minGrade2020)/2+50)*0.40;
    								rate=rate+rate2;
								}
							}
							
						}else {//只有2年数据，全国的
							int heightYears=0;//这两年中，同位分大于平均分的年份数=2，则+70，如果年份数=1，则+60，都不大于平均分，则+50
    						if(avgGrade2022>0&&qgj2022-avgGrade2022>0) heightYears++;
    						if(avgGrade2021>0&&qgj2021-avgGrade2021>0) heightYears++;
    						if(avgGrade2020>0&&qgj2020-avgGrade2020>0) heightYears++;
							
							if(avgGrade2022>0) {//2022年有数据
								if(heightYears==2) {
									double rate1=((qgj2022-avgGrade2022)/2+70)*0.60;
    								rate=rate+rate1;
    								
    								if(avgGrade2021>0) {
        								double rate2=((qgj2021-avgGrade2021)/2+70)*0.40;
        								rate=rate+rate2;
        							}else {
        								double rate2=((qgj2020-avgGrade2020)/2+70)*0.40;
        								rate=rate+rate2;
        							}
								}else if(heightYears==1) {
									if(qgj2022-avgGrade2022>0) {
										double rate1=((qgj2022-avgGrade2022)/2+60)*0.60;
        								rate=rate+rate1;
									}else {
										double rate1=((qgj2022-minGrade2022)/2+50)*0.60;
        								rate=rate+rate1;
									}
									if(avgGrade2021>0) {
    									if(qgj2021-avgGrade2021>0) {
    										double rate1=((qgj2021-avgGrade2021)/2+60)*0.40;
            								rate=rate+rate1;
    									}else {
    										double rate1=((qgj2021-minGrade2021)/2+60)*0.40;
            								rate=rate+rate1;
    									}
									}else {
										if(qgj2020-avgGrade2020>0) {
    										double rate1=((qgj2020-avgGrade2020)/2+60)*0.40;
            								rate=rate+rate1;
    									}else {
    										double rate1=((qgj2020-minGrade2020)/2+60)*0.40;
            								rate=rate+rate1;
    									}
									}
								}else {//都不高于平均分
									double rate1=((qgj2022-minGrade2022)/2+50)*0.60;
    								rate=rate+rate1;
    								if(avgGrade2021>0) {
    									double rate2=((qgj2021-minGrade2021)/2+50)*0.60;
        								rate=rate+rate2;
    								}else {
    									double rate2=((qgj2020-minGrade2020)/2+50)*0.40;
        								rate=rate+rate2;
    								}
								}
							}else {//2022年没数据，只有2021和2020年数据
								if(heightYears==2) {
									double rate1=((qgj2021-avgGrade2021)/2+70)*0.60+((qgj2020-avgGrade2020)/2+70)*0.40;
									rate=rate+rate1;
								}else if(heightYears==1) {
									if(qgj2021-avgGrade2021>0) {
										double rate1=((qgj2021-avgGrade2021)/2+60)*0.60;
										rate=rate+rate1;
									}else {
										double rate1=((qgj2021-minGrade2021)/2+50)*0.60;
										rate=rate+rate1;
									}
									if(qgj2020-avgGrade2020>0) {
										double rate1=((qgj2020-avgGrade2020)/2+60)*0.40;
										rate=rate+rate1;
									}else {
										double rate1=((qgj2020-minGrade2020)/2+50)*0.40;
										rate=rate+rate1;
									}
								}else {
									double rate1=((qgj2021-minGrade2021)/2+50)*0.60;
    								rate=rate+rate1;
        							
    								double rate2=((qgj2020-minGrade2020)/2+50)*0.40;
    								rate=rate+rate2;
								}
							}
							
						}
						
						/*
						if(plan2023<10) {
							double rate2=plan2023-plan2022;
							if(rate2>30) rate2=30;
							if(rate2<-30) rate2=-30;
							rate=rate+rate2;
						}else if(plan2023>=10&&plan2023<50) {
							double rate2=(plan2023-plan2022)*0.5;
							if(rate2>30) rate2=30;
							if(rate2<-30) rate2=-30;
							rate=rate+rate2;
						}else if(plan2023>=50&&plan2023<100) {
							double rate2=(plan2023-plan2022)*0.3;
							if(rate2>30) rate2=30;
							if(rate2<-30) rate2=-30;
							rate=rate+rate2;
						}else if(plan2023>=100) {
							double rate2=(plan2023-plan2022)*0.1;
							if(rate2>30) rate2=30;
							if(rate2<-30) rate2=-30;
							rate=rate+rate2;
						}
						*/
						if(rate>=100) rate=99.99;
						if(rate<1) rate=1;
						schoolRecord2020.setSubmitRate(df.format(rate));
						schoolRecord2021.setSubmitRate(df.format(rate));
						schoolRecord2022.setSubmitRate(df.format(rate));    
					}else {//只有一年数据
						if(provinceName.equals("广西")) {

    						if(avgGrade2022>0) {
								double rate=((gxj2022-minGrade2022)/2)+50;
								/*
								if(plan2023<10) {
    								double rate2=plan2023-plan2022;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=10&&plan2023<50) {
    								double rate2=(plan2023-plan2022)*0.5;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=50&&plan2023<100) {
    								double rate2=(plan2023-plan2022)*0.3;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=100) {
    								double rate2=(plan2023-plan2022)*0.1;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}
    							*/
								if(rate>=100) rate=99.99;
								if(rate<1) rate=1;
								schoolRecord2020.setSubmitRate(df.format(rate));
    							schoolRecord2021.setSubmitRate(df.format(rate));
    							schoolRecord2022.setSubmitRate(df.format(rate));    
							}
    						if(avgGrade2021>0) {
								double rate=((gxj2021-minGrade2021)/2)+50;
								/*
								if(plan2023<10) {
    								double rate2=plan2023-plan2022;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=10&&plan2023<50) {
    								double rate2=(plan2023-plan2022)*0.5;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=50&&plan2023<100) {
    								double rate2=(plan2023-plan2022)*0.3;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=100) {
    								double rate2=(plan2023-plan2022)*0.1;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}
    							*/
								if(rate>=100) rate=99.99;
								if(rate<1) rate=1;
								schoolRecord2020.setSubmitRate(df.format(rate));
    							schoolRecord2021.setSubmitRate(df.format(rate));
    							schoolRecord2022.setSubmitRate(df.format(rate));    
							}
    						if(avgGrade2020>0) {
								double rate=((gxj2020-minGrade2020)/2)+50;
								/*
								if(plan2023<10) {
    								double rate2=plan2023-plan2022;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=10&&plan2023<50) {
    								double rate2=(plan2023-plan2022)*0.5;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=50&&plan2023<100) {
    								double rate2=(plan2023-plan2022)*0.3;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=100) {
    								double rate2=(plan2023-plan2022)*0.1;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}
    							*/
								if(rate>=100) rate=99.99;
								if(rate<1) rate=1;
								schoolRecord2020.setSubmitRate(df.format(rate));
    							schoolRecord2021.setSubmitRate(df.format(rate));
    							schoolRecord2022.setSubmitRate(df.format(rate));    
							}
						}else {//全国只有一年数据
							if(avgGrade2022>0) {
								double rate=((qgj2022-minGrade2022)/2)+50;
								/*
								if(plan2023<10) {
    								double rate2=plan2023-plan2022;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=10&&plan2023<50) {
    								double rate2=(plan2023-plan2022)*0.5;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=50&&plan2023<100) {
    								double rate2=(plan2023-plan2022)*0.3;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=100) {
    								double rate2=(plan2023-plan2022)*0.1;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}
    							*/
								if(rate>=100) rate=99.99;
								if(rate<1) rate=1;
								schoolRecord2020.setSubmitRate(df.format(rate));
    							schoolRecord2021.setSubmitRate(df.format(rate));
    							schoolRecord2022.setSubmitRate(df.format(rate));    
							}
    						if(avgGrade2021>0) {
								double rate=((qgj2021-minGrade2021)/2)+50;
								/*
								if(plan2023<10) {
    								double rate2=plan2023-plan2022;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=10&&plan2023<50) {
    								double rate2=(plan2023-plan2022)*0.5;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=50&&plan2023<100) {
    								double rate2=(plan2023-plan2022)*0.3;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=100) {
    								double rate2=(plan2023-plan2022)*0.1;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}
    							*/
								if(rate>=100) rate=99.99;
								if(rate<1) rate=1;
								schoolRecord2020.setSubmitRate(df.format(rate));
    							schoolRecord2021.setSubmitRate(df.format(rate));
    							schoolRecord2022.setSubmitRate(df.format(rate));    
							}
    						if(avgGrade2020>0) {
								double rate=((qgj2020-minGrade2020)/2)+50;
								/*
								if(plan2023<10) {
    								double rate2=plan2023-plan2022;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=10&&plan2023<50) {
    								double rate2=(plan2023-plan2022)*0.5;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=50&&plan2023<100) {
    								double rate2=(plan2023-plan2022)*0.3;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=100) {
    								double rate2=(plan2023-plan2022)*0.1;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}
    							*/
								if(rate>=100) rate=99.99;
								if(rate<1) rate=1;
								schoolRecord2020.setSubmitRate(df.format(rate));
    							schoolRecord2021.setSubmitRate(df.format(rate));
    							schoolRecord2022.setSubmitRate(df.format(rate));    
							}
						}
					}
				}

				/**
				 * 旧的投档概率只占20%，跟2024年最低录取分数线比较的概率，占80%
				 * 专业组投档概率:今年的考生输入分数a后先和去年的院校专业组投档线b比较，
				 * 如果一样的分数投档概率为50%，以2分为1%的基数，得出一个概率c,比如a=460，b=450,
				 * 那么c=(460－450)÷2+50%=55%，系统现在显示的概率为d,假如现在系统显示的投档概率为50%，
				 * 如果现在定的最终概率为e,那么e=(55%X80+50%X20%）÷2=54%
				 */

				for(int s=0;s<plans2024List.size();s++){
					SchoolPlan plan2024= plans2024List.get(s);
					//学校和专业组相等
					if(plan2024.getSchoolCode().equals(schoolRecord2022.getScode())
							&&plan2024.getZyz().equals(schoolRecord2022.getZyz())){
						//最低录取分数线
						int grade=plan2024.getGrade();
						int memberGrade=memberQuery.getGrade();
						//if(schoolRecord2022.getSubmitRate()!=null) {
							//double rate=new Double(schoolRecord2022.getSubmitRate());
							//((考生成绩-录取最低分)/2+50)*0.8+schoolRecord2022.getSubmitRate()*0.2
							//double finalRate = ((memberGrade - grade) / 2 + 50) * 0.8 + rate * 0.2;
                            double finalRate = (memberGrade - grade) / 2 + 50;

							if(finalRate>=100) finalRate=99.99;
							if(finalRate<1) finalRate=1;
						if(schoolRecord2022.getMinGrade()!=null&&schoolRecord2021.getMinGrade()!=null&&schoolRecord2020.getMinGrade()!=null){
							schoolRecord2020.setSubmitRate(df.format(finalRate));
							schoolRecord2021.setSubmitRate(df.format(finalRate));
							schoolRecord2022.setSubmitRate(df.format(finalRate));
						}else{
							schoolRecord2020.setSubmitRate("-");
							schoolRecord2021.setSubmitRate("-");
							schoolRecord2022.setSubmitRate("-");
						}
						//}

					}
				}
				
				if(schoolRecord2022.getSubmitRate()==null) {
					schoolRecord2022.setSubmitRate("-");
				}
				if(schoolRecord2022.getPlanSubmitAdmission()==null) {
					schoolRecord2022.setPlanSubmitAdmission("-");
				}
				
				
				if(schoolRecord2022.getAvgGradeSeq()==null||schoolRecord2022.getAvgGradeSeq().equals("99999999")) {
					schoolRecord2022.setAvgGradeSeq("-");
				}
				
				if(schoolRecord2022.getMinGradeSeq()==null||schoolRecord2022.getMinGradeSeq().equals("99999999")) {
					schoolRecord2022.setMinGradeSeq("-");
				}
				
				if(schoolRecord2021.getSubmitRate()==null) {
					schoolRecord2021.setSubmitRate("-");
					
				}
				if(schoolRecord2021.getPlanSubmitAdmission()==null) {
					schoolRecord2021.setPlanSubmitAdmission("-");
				}
				
				if(schoolRecord2021.getAvgGradeSeq()==null||schoolRecord2021.getAvgGradeSeq().equals("99999999")) {
					schoolRecord2021.setAvgGradeSeq("-");
				}
				
				if(schoolRecord2021.getMinGradeSeq()==null||schoolRecord2021.getMinGradeSeq().equals("99999999")) {
					schoolRecord2021.setMinGradeSeq("-");
				}
				
				
				if(schoolRecord2020.getSubmitRate()==null) {
					schoolRecord2020.setSubmitRate("-");
				}
				if(schoolRecord2020.getPlanSubmitAdmission()==null) {
					schoolRecord2020.setPlanSubmitAdmission("-");
				}
				
				if(schoolRecord2020.getAvgGradeSeq()==null||schoolRecord2020.getAvgGradeSeq().equals("99999999")) {
					schoolRecord2020.setAvgGradeSeq("-");
				}
				
				if(schoolRecord2020.getMinGradeSeq()==null||schoolRecord2020.getMinGradeSeq().equals("99999999")) {
					schoolRecord2020.setMinGradeSeq("-");
				}
				
				
				
				
				
				returnList.add(schoolRecord2022);
				returnList.add(schoolRecord2021);
				returnList.add(schoolRecord2020);
        		
        		
				map.put("returnList", returnList);
        		
				
				
				/*******************************************
				 * 
				 * 计算该专业组下的各专业的录取概率
				 * 
				 */
				
        		
				//该专业组下各专业录取概率
				List<SchoolMajorYearAdmission> zyList =new ArrayList();
        		//该专业今年的招生计划（从计划表中取）
				schoolPlanQuery.setZyz(zyz);
				if("物理".equals(memberQuery.getSxkm())) {
	        		schoolPlanQuery.setMajorType("理工类");
	        	}
	        	if("历史".equals(memberQuery.getSxkm())) {
	        		schoolPlanQuery.setMajorType("文史类");
	        	}
	        	
	        	//如果会员不是少数民族，则不能查询民族班
	        	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
	        		schoolPlanQuery.setSsmzFlag(0);
	        	}
	        	
	        	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
	        		schoolPlanQuery.setGjzxFlag(0);
	        	}
	        	
	        	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
	        		schoolPlanQuery.setGxzxFlag(0);
	        	}
	        	
	        	
				List<SchoolPlan> zyPlans2023List =schoolPlanService.selectSchoolZyPlan2023List(schoolPlanQuery);
				
				//该专业当年的招生计划和录取情况（从录取指南中取）
				//查询各个专业近3年的平均分、最低分（当前计算，先以2020,2021,2022这3年的录取数据为模拟数据）
	        	SchoolMajorYearAdmission schoolMajorYearAdmissionQuery=new SchoolMajorYearAdmission();
	        	schoolMajorYearAdmissionQuery.setYear(thisYear);
	        	schoolMajorYearAdmissionQuery.setsCode(schoolCode);
	        	if("物理".equals(memberQuery.getSxkm())) {
	        		schoolMajorYearAdmissionQuery.setMajorType("理工类");
	        	}
	        	if("历史".equals(memberQuery.getSxkm())) {
	        		schoolMajorYearAdmissionQuery.setMajorType("文史类");
	        	}
	        	schoolMajorYearAdmissionQuery.setZyz(zyz);
	        	
	        	//如果会员不是少数民族，则不能查询民族班
	        	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
	        		schoolMajorYearAdmission.setSsmzFlag(0);
	        	}
	        	
	        	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
	        		schoolMajorYearAdmission.setGjzxFlag(0);
	        	}
	        	
	        	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
	        		schoolMajorYearAdmission.setGxzxFlag(0);
	        	}
	        	
	        	//考生的再选科目
	        	schoolMajorYearAdmission.setZxkm(memberQuery.getZxkm());
	        	
	        	schoolMajorYearAdmission.setZyz(zyz);
	        	
	        	List<SchoolMajorYearAdmission> majorGradeList=schoolMajorYearAdmissionService.selectSchoolMajorZyYearAdmissionList(schoolMajorYearAdmissionQuery);
	        	
	        	//各专业录取明细
	        	List<SchoolMajorYearAdmission> majorGradeDetailList=schoolMajorYearAdmissionService.selectSchoolMajorZyYearAdmissionDetailList(schoolMajorYearAdmissionQuery);
	        	
	        	
	        	for(int k=0;k<zyPlans2023List.size();k++) {
	        		SchoolPlan schoolPlan=zyPlans2023List.get(k);
	        		
	        		int zyavgGrade2022=0;
    				int zyminGrade2022=0;
    				int zyavgGrade2021=0;
    				int zyminGrade2021=0;
    				int zyavgGrade2020=0;
    				int zyminGrade2020=0;
    				
    				//历史招生数量，从指南取
    				int zyplan2022=0;
    				int zysubmit2022=0;
    				int zyadm2022=0;
    				int zyplan2021=0;
    				int zysubmit2021=0;
    				int zyadm2021=0;
    				int zyplan2020=0;
    				int zysubmit2020=0;
    				int zyadm2020=0;
    				
    				//当年招生数量，从招生计划取
    				int zyplan2023=schoolPlan.getMajorPlan();
	        		
	        		SchoolMajorYearAdmission schoolMajorYearAdmission2022=new SchoolMajorYearAdmission();
	        		schoolMajorYearAdmission2022.setYear(yearNew1);
	        		schoolMajorYearAdmission2022.setMajorCode(schoolPlan.getMajorCode());
	        		schoolMajorYearAdmission2022.setMajorSeq(schoolPlan.getMajorSeq());
	        		schoolMajorYearAdmission2022.setMajor(schoolPlan.getMajorName());
	        		schoolMajorYearAdmission2022.setThisYearMajorPlan(schoolPlan.getMajorPlan());
	        		schoolMajorYearAdmission2022.setsCode(schoolPlan.getSchoolCode());
	        		schoolMajorYearAdmission2022.setZyz(schoolPlan.getZyz());
	        		
	        		
	        		if(provinceName.equals("广西")) {
	        			schoolMajorYearAdmission2022.setSeqGrade(new Integer(gxj2022).toString());
	        			schoolMajorYearAdmission2022.setSeq(new Integer(gxpw).toString());
    				}else {
    					schoolMajorYearAdmission2022.setSeqGrade(new Integer(qgj2022).toString());
    					schoolMajorYearAdmission2022.setSeq(new Integer(qgpw).toString());
    				}
    				
    				
    				//设置分数线
    				if("物理".equals(memberQuery.getSxkm())) {
    					schoolMajorYearAdmission2022.setGradeLine(new Integer(gradeLineLg2022).toString());
    				}
    				if("历史".equals(memberQuery.getSxkm())) {
    					schoolMajorYearAdmission2022.setGradeLine(new Integer(gradeLineWs2022).toString());
    				}
    				
    				SchoolMajorYearAdmission zyadmission2022=null;
    				SchoolMajorYearAdmission zyadmission2021=null;
    				SchoolMajorYearAdmission zyadmission2020=null;
    				for(int j=0;j<majorGradeList.size();j++) {
    					SchoolMajorYearAdmission admission=majorGradeList.get(j);
    					
    					
    					if(schoolPlan.getMajorCode().equals(admission.getMajorCode())) {//同一个专业        						
    						if(admission.getYear()==yearNew1) {
    							zyadmission2022=admission;
    						}
    						if(admission.getYear()==yearNew2) {
    							zyadmission2021=admission;
    						}
    						if(admission.getYear()==yearNew3) {
    							zyadmission2020=admission;
    						}
    					}
    				}
    				
    				
    				if(zyadmission2022!=null&&zyadmission2022.getAvgGrade()!=null) {
    					schoolMajorYearAdmission2022.setAvgGradeStr(zyadmission2022.getAvgGrade().toString());
    					schoolMajorYearAdmission2022.setMinGradeStr(zyadmission2022.getLowGrade().toString());
                        schoolMajorYearAdmission2022.setAdmission(zyadmission2022.getAdmission());
    					zyavgGrade2022=zyadmission2022.getAvgGrade();
    					zyminGrade2022=zyadmission2022.getLowGrade();
    					
    					
    					//计算平均分排位，最低分排位
    					int avgGrade2022Seq=99999999;
    					int lastSeq=1;
    					for(int m=0;m<hisPwGradeList.size();m++) {
    						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
    						if(hisGradeDoc.getYear().intValue()==yearNew1) {
    							
    							
    							int myGrade=hisGradeDoc.getGrade();
    							
    							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
    								if(hisGradeDoc.getUseIn().equals("广西")) {
    									int fencha=myGrade-zyavgGrade2022;
    									if(fencha==0) {
    										avgGrade2022Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										avgGrade2022Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    									
    								}
    							}else {
    								if(hisGradeDoc.getUseIn().equals("全国")) {
    									int fencha=myGrade-zyavgGrade2022;
    									if(fencha==0) {
    										avgGrade2022Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										avgGrade2022Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    								}
    							}
    							
    						}
    					}
    					
    					schoolMajorYearAdmission2022.setAvgGradeSeq(new Integer(avgGrade2022Seq).toString());
    					
    					
    					int minGrade2022Seq=99999999;
    					lastSeq=1;
    					for(int m=0;m<hisPwGradeList.size();m++) {
    						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
    						if(hisGradeDoc.getYear().intValue()==yearNew1) {
    							
    							
    							int myGrade=hisGradeDoc.getGrade();
    							
    							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
    								if(hisGradeDoc.getUseIn().equals("广西")) {
    									int fencha=myGrade-zyminGrade2022;
    									if(fencha==0) {
    										minGrade2022Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										minGrade2022Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    									
    								}
    							}else {
    								if(hisGradeDoc.getUseIn().equals("全国")) {
    									int fencha=myGrade-zyminGrade2022;
    									if(fencha==0) {
    										minGrade2022Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										minGrade2022Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    								}
    							}
    							
    						}
    					}
    					
    					schoolMajorYearAdmission2022.setMinGradeSeq(new Integer(minGrade2022Seq).toString());
    					
    					
    				}else {
    					schoolMajorYearAdmission2022.setAvgGradeStr("-");
    					schoolMajorYearAdmission2022.setMinGradeStr("-");
    					schoolMajorYearAdmission2022.setAvgGradeSeq("-");
    					schoolMajorYearAdmission2022.setMinGradeSeq("-");
    				}
    				
    				if(zyadmission2022!=null) {
	    				zyplan2022=zyadmission2022.getPlan();
						
						schoolMajorYearAdmission2022.setMajorPlan(zyplan2022);
						
						if(zyadmission2022.getSubmit()!=null) {
							zysubmit2022=zyadmission2022.getSubmit();
						}
						if(zyadmission2022.getAdmission()!=null) {
							zyadm2022=zyadmission2022.getAdmission();
						}
						
						schoolMajorYearAdmission2022.setPlanSubmitAdmission(plan2022+"-"+adm2022);
    				}
    				

    				SchoolMajorYearAdmission schoolMajorYearAdmission2021=new SchoolMajorYearAdmission();
	        		schoolMajorYearAdmission2021.setYear(yearNew2);
	        		schoolMajorYearAdmission2021.setMajorCode(schoolPlan.getMajorCode());
	        		schoolMajorYearAdmission2021.setMajorSeq(schoolPlan.getMajorSeq());
	        		schoolMajorYearAdmission2021.setMajor(schoolPlan.getMajorName());
	        		schoolMajorYearAdmission2021.setThisYearMajorPlan(schoolPlan.getMajorPlan());
	        		schoolMajorYearAdmission2021.setsCode(schoolPlan.getSchoolCode());
	        		schoolMajorYearAdmission2021.setZyz(schoolPlan.getZyz());
	        		
	        		
	        		if(provinceName.equals("广西")) {
	        			schoolMajorYearAdmission2021.setSeqGrade(new Integer(gxj2021).toString());
	        			schoolMajorYearAdmission2021.setSeq(new Integer(gxpw).toString());
    				}else {
    					schoolMajorYearAdmission2021.setSeqGrade(new Integer(qgj2021).toString());
    					schoolMajorYearAdmission2021.setSeq(new Integer(qgpw).toString());
    				}
    				
    				
    				//设置分数线
    				if("物理".equals(memberQuery.getSxkm())) {
    					schoolMajorYearAdmission2021.setGradeLine(new Integer(gradeLineLg2021).toString());
    				}
    				if("历史".equals(memberQuery.getSxkm())) {
    					schoolMajorYearAdmission2021.setGradeLine(new Integer(gradeLineWs2021).toString());
    				}
    				
    				
    				
    				
    				if(zyadmission2021!=null&&zyadmission2021.getAvgGrade()!=null) {
    					schoolMajorYearAdmission2021.setAvgGradeStr(zyadmission2021.getAvgGrade().toString());
    					schoolMajorYearAdmission2021.setMinGradeStr(zyadmission2021.getLowGrade().toString());
                        schoolMajorYearAdmission2021.setAdmission(zyadmission2021.getAdmission());
    					zyavgGrade2021=zyadmission2021.getAvgGrade();
    					zyminGrade2021=zyadmission2021.getLowGrade();
    					
    					
    					//计算平均分排位，最低分排位
    					int avgGrade2021Seq=99999999;
    					int lastSeq=1;
    					for(int m=0;m<hisPwGradeList.size();m++) {
    						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
    						if(hisGradeDoc.getYear().intValue()==yearNew2) {
    							
    							
    							int myGrade=hisGradeDoc.getGrade();
    							
    							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
    								if(hisGradeDoc.getUseIn().equals("广西")) {
    									int fencha=myGrade-zyavgGrade2021;
    									if(fencha==0) {
    										avgGrade2021Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										avgGrade2021Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    									
    								}
    							}else {
    								if(hisGradeDoc.getUseIn().equals("全国")) {
    									int fencha=myGrade-zyavgGrade2021;
    									if(fencha==0) {
    										avgGrade2021Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										avgGrade2021Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    								}
    							}
    							
    						}
    					}
    					
    					schoolMajorYearAdmission2021.setAvgGradeSeq(new Integer(avgGrade2021Seq).toString());
    					
    					
    					int minGrade2021Seq=99999999;
    					lastSeq=1;
    					for(int m=0;m<hisPwGradeList.size();m++) {
    						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
    						if(hisGradeDoc.getYear().intValue()==yearNew2) {
    							
    							
    							int myGrade=hisGradeDoc.getGrade();
    							
    							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
    								if(hisGradeDoc.getUseIn().equals("广西")) {
    									int fencha=myGrade-zyminGrade2021;
    									if(fencha==0) {
    										minGrade2021Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										minGrade2021Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    									
    								}
    							}else {
    								if(hisGradeDoc.getUseIn().equals("全国")) {
    									int fencha=myGrade-zyminGrade2021;
    									if(fencha==0) {
    										minGrade2021Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										minGrade2021Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    								}
    							}
    							
    						}
    					}
    					
    					schoolMajorYearAdmission2021.setMinGradeSeq(new Integer(minGrade2021Seq).toString());
    					
    					
    					
    					
    				}else {
    					schoolMajorYearAdmission2021.setAvgGradeStr("-");
    					schoolMajorYearAdmission2021.setMinGradeStr("-");
    					schoolMajorYearAdmission2021.setMinGradeSeq("-");
    					schoolMajorYearAdmission2021.setAvgGradeSeq("-");
    				}
    				
    				if(zyadmission2021!=null) {
	    				zyplan2021=zyadmission2021.getPlan();
						schoolMajorYearAdmission2021.setMajorPlan(zyplan2021);
						if(zyadmission2021.getSubmit()!=null) {
							zysubmit2021=zyadmission2021.getSubmit();
						}
						if(zyadmission2021.getAdmission()!=null) {
							zyadm2021=zyadmission2021.getAdmission();
						}
						schoolMajorYearAdmission2021.setPlanSubmitAdmission(plan2021+"-"+adm2021);
    				}
    				
    				
    				SchoolMajorYearAdmission schoolMajorYearAdmission2020=new SchoolMajorYearAdmission();
	        		schoolMajorYearAdmission2020.setYear(yearNew3);
	        		schoolMajorYearAdmission2020.setMajorCode(schoolPlan.getMajorCode());
	        		schoolMajorYearAdmission2020.setMajorSeq(schoolPlan.getMajorSeq());
	        		schoolMajorYearAdmission2020.setMajor(schoolPlan.getMajorName());
	        		schoolMajorYearAdmission2020.setThisYearMajorPlan(schoolPlan.getMajorPlan());
	        		schoolMajorYearAdmission2020.setsCode(schoolPlan.getSchoolCode());
	        		schoolMajorYearAdmission2020.setZyz(schoolPlan.getZyz());
	        		
	        		
	        		if(provinceName.equals("广西")) {
	        			schoolMajorYearAdmission2020.setSeqGrade(new Integer(gxj2020).toString());
	        			schoolMajorYearAdmission2020.setSeq(new Integer(gxpw).toString());
    				}else {
    					schoolMajorYearAdmission2020.setSeqGrade(new Integer(qgj2020).toString());
    					schoolMajorYearAdmission2020.setSeq(new Integer(qgpw).toString());
    				}
    				
    				
    				//设置分数线
    				if("物理".equals(memberQuery.getSxkm())) {
    					schoolMajorYearAdmission2020.setGradeLine(new Integer(gradeLineLg2020).toString());
    				}
    				if("历史".equals(memberQuery.getSxkm())) {
    					schoolMajorYearAdmission2020.setGradeLine(new Integer(gradeLineWs2020).toString());
    				}
    				
    				
    				
    				if(zyadmission2020!=null&&zyadmission2020.getAvgGrade()!=null) {
    					schoolMajorYearAdmission2020.setAvgGradeStr(zyadmission2020.getAvgGrade().toString());
    					schoolMajorYearAdmission2020.setMinGradeStr(zyadmission2020.getLowGrade().toString());
                        schoolMajorYearAdmission2020.setAdmission(zyadmission2020.getAdmission());
    					zyavgGrade2020=zyadmission2020.getAvgGrade();
    					zyminGrade2020=zyadmission2020.getLowGrade();
    					
    					
    					
    					//计算平均分排位，最低分排位
    					int avgGrade2020Seq=99999999;
    					int lastSeq=1;
    					for(int m=0;m<hisPwGradeList.size();m++) {
    						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
    						if(hisGradeDoc.getYear().intValue()==yearNew3) {
    							
    							
    							int myGrade=hisGradeDoc.getGrade();
    							
    							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
    								if(hisGradeDoc.getUseIn().equals("广西")) {
    									int fencha=myGrade-zyavgGrade2020;
    									if(fencha==0) {
    										avgGrade2020Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										avgGrade2020Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    									
    								}
    							}else {
    								if(hisGradeDoc.getUseIn().equals("全国")) {
    									int fencha=myGrade-zyavgGrade2020;
    									if(fencha==0) {
    										avgGrade2020Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										avgGrade2020Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    								}
    							}
    							
    						}
    					}
    					
    					schoolMajorYearAdmission2020.setAvgGradeSeq(new Integer(avgGrade2020Seq).toString());
    					
    					
    					int minGrade2020Seq=99999999;
    					lastSeq=1;
    					for(int m=0;m<hisPwGradeList.size();m++) {
    						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
    						if(hisGradeDoc.getYear().intValue()==yearNew3) {
    							
    							
    							int myGrade=hisGradeDoc.getGrade();
    							
    							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
    								if(hisGradeDoc.getUseIn().equals("广西")) {
    									int fencha=myGrade-zyminGrade2020;
    									if(fencha==0) {
    										minGrade2020Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										minGrade2020Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    									
    								}
    							}else {
    								if(hisGradeDoc.getUseIn().equals("全国")) {
    									int fencha=myGrade-zyminGrade2020;
    									if(fencha==0) {
    										minGrade2020Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										minGrade2020Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    								}
    							}
    							
    						}
    					}
    					schoolMajorYearAdmission2020.setMinGradeSeq(new Integer(minGrade2020Seq).toString());
    					
    					
    					
    					
    				}else {
    					schoolMajorYearAdmission2020.setAvgGradeStr("-");
    					schoolMajorYearAdmission2020.setMinGradeStr("-");
    					
    					schoolMajorYearAdmission2020.setAvgGradeSeq("-");
    					schoolMajorYearAdmission2020.setMinGradeSeq("-");
    				}
    				if(zyadmission2020!=null) {
    				
	    				zyplan2020=zyadmission2020.getPlan();
						schoolMajorYearAdmission2020.setMajorPlan(zyplan2020);
						if(zyadmission2020.getSubmit()!=null) {
							zysubmit2020=zyadmission2020.getSubmit();
						}
						if(zyadmission2020.getAdmission()!=null) {
							zyadm2020=zyadmission2020.getAdmission();
						}
						schoolMajorYearAdmission2020.setPlanSubmitAdmission(plan2020+"-"+adm2020);
    				}
    				
    				//开始计算投档概率
    				/*
    				 * 
    				 * 
    				 * 
    				 *  专业投档概率计算
                  如果2023年招生人数<2022年招生人数，则(((2022年同位分-（2023年人数）的名次录取分))/2+50%)*55%   否则如果2023年招生人数>2022年招生人数,则((2022年同位分-（2022录取人数的最后一名的录取分)/2+50%)*55%，
                  如果2023年招生人数<2021年招生人数，则(2021年同位分-（2023年人数）的名次录取分))/2+50%)*30%+  否则如果2023年招生人数>2021年招生人数,则((2021年同位分-（2021录取人数的最后一名的录取分)/2+50%)*30%，
                  如果2023年招生人数<2020年招生人数，则(2020年同位分-（2023年人数）的名次录取分))/2+50%)*15%+  否则如果2023年招生人数>2020年招生人数,则((2020年同位分-（2020录取人数的最后一名的录取分)/2+50%)*15%，   

    				 * 
    				 * 招生数量对比占的概率
    				 * 1.当年招生数量，H是当年的招生数量，I是去年的招生数量
    				 * H＜=20，（H-I）%=h
                       20＜=H＜50,（H-I）×0.5%=h。
                       50＜H＜100,（H-I）×0.3%=h。
                       100＜H,（H-I）×0.1%=h。
                      
                      //目前的数据，投档数都是0，所以下面的内容暂时不算了 
                      2. I是去年的招生数量，L是去年的专业投档数 ；J是前年的招生数量，M是前年的专业投档数；K是大前年的招生数量，N是大前年的专业投档数
                      I-L为正数，增加5%概率，以i代替。
                      J-M为正数，增加5%概率，以j代替。
                      K-N为正数，增加5%概率，以k代替。
                       
    				 */
    				
    				
    				/*
    				
    				int year2022Grade=0;//当年录取名次上一个名次对应的分数
    				int year2021Grade=0;//当年录取名次上一个名次对应的分数
    				int year2020Grade=0;//当年录取名次上一个名次对应的分数
    				int admissionYears=0; //录取情况数，有3年录取情况的，按55%，30%，15%比例分派。有2年录取数据的，按60%，40%比例分派，只有1年数据的按100%
    				
    				//当年同位分-名次分的大小，3年高于+80%，2年高于+70,1年高于+60，都没有高于+50
    				int heighPlan=0;
    				
    				if(zyplan2023<zyadm2022) {//2022年招生比2023年人数多
    					
    					
    					
    					int seq=zyplan2023;//需要计算的录取名次，找到该录取名次对应的分数,2022年录取10人，2023年只找6人，则需要找出2022年录取第6名的成绩
						
						int yearSeq=0;//当年录取的名次
						
						int yearLastGrade=0;
						for(int u=0;u<majorGradeDetailList.size();u++) {
							SchoolMajorYearAdmission majorGradeDetail=majorGradeDetailList.get(u);
							if(majorGradeDetail.getYear()==2022&&majorGradeDetail.getMajorCode().equals(schoolPlan.getMajorCode())) {
								if(majorGradeDetail.getAdmission2()==null) {
									break;
								}
								yearSeq=yearSeq+majorGradeDetail.getAdmission2();
								if(yearSeq-zyplan2023<0) {
									yearLastGrade=majorGradeDetail.getGrade();
								}else if(yearSeq-zyplan2023==0) {
									year2022Grade=majorGradeDetail.getGrade();
									break;
								}else if(yearSeq-zyplan2023>0) {
									year2022Grade=yearLastGrade;
									break;
								}
							}
								
						}
						if(year2022Grade>0) {
							admissionYears++;
							if(provinceName.equals("广西")) {//用广西同位分
								if(gxj2022-year2022Grade>0) heighPlan++;
							}else {//用全国同位分
								if(qgj2022-year2022Grade>0) heighPlan++;
							}
						}
						
    				}else {//2022年招生比2023年人数少，取2022年最后一名领取分作为名次对应的分数

    					
    					for(int u=0;u<majorGradeDetailList.size();u++) {
							SchoolMajorYearAdmission majorGradeDetail=majorGradeDetailList.get(u);
							if(majorGradeDetail.getYear()==2022&&majorGradeDetail.getMajorCode().equals(schoolPlan.getMajorCode())) {
								
								if(majorGradeDetail.getAdmission2()==null) {
									break;
								}
								year2022Grade=majorGradeDetail.getGrade();//循环到最后一名，得到最后一名的分数
							}
    					}
    					
    					if(year2022Grade>0) {
    						admissionYears++;
	    					if(provinceName.equals("广西")) {//用广西同位分
								if(gxj2022-year2022Grade>0) heighPlan++;
							}else {//用全国同位分
								if(qgj2022-year2022Grade>0) heighPlan++;
							}
    					}
    				}
    				
    				if(zyplan2023<zyadm2021) {//2021年招生比2023年人数多
    					
    					
    					
    					int seq=zyplan2023;//需要计算的录取名次，找到该录取名次对应的分数,2022年录取10人，2023年只找6人，则需要找出2022年录取第6名的成绩
						
						int yearSeq=0;//当年录取的名次
						int yearLastGrade=0;
						for(int u=0;u<majorGradeDetailList.size();u++) {
							SchoolMajorYearAdmission majorGradeDetail=majorGradeDetailList.get(u);
							if(majorGradeDetail.getYear()==2021&&majorGradeDetail.getMajorCode().equals(schoolPlan.getMajorCode())) {
								
								if(majorGradeDetail.getAdmission2()==null) {
									break;
								}
								
								yearSeq=yearSeq+majorGradeDetail.getAdmission2();
								if(yearSeq-zyplan2023<0) {
									yearLastGrade=majorGradeDetail.getGrade();
								}else if(yearSeq-zyplan2023==0) {
									year2021Grade=majorGradeDetail.getGrade();
									break;
								}else if(yearSeq-zyplan2023>0) {
									year2021Grade=yearLastGrade;
									break;
								}
							}
								
						}
						if(year2021Grade>0) {
							admissionYears++;
							if(provinceName.equals("广西")) {//用广西同位分
								if(gxj2021-year2021Grade>0) heighPlan++;
							}else {//用全国同位分
								if(qgj2021-year2021Grade>0) heighPlan++;
							}
						}
    					
    				}else {//2021招生比2023年人数少，取2021年最后一名领取分作为名次对应的分数

    					
    					for(int u=0;u<majorGradeDetailList.size();u++) {
							SchoolMajorYearAdmission majorGradeDetail=majorGradeDetailList.get(u);
							if(majorGradeDetail.getYear()==2021&&majorGradeDetail.getMajorCode().equals(schoolPlan.getMajorCode())) {
								
								if(majorGradeDetail.getAdmission2()==null) {
									break;
								}
								
								year2021Grade=majorGradeDetail.getGrade();//循环到最后一名，得到最后一名的分数
							}
    					}
    					if(year2021Grade>0) {
    						admissionYears++;
	    					if(provinceName.equals("广西")) {//用广西同位分
								if(gxj2021-year2021Grade>0) heighPlan++;
							}else {//用全国同位分
								if(qgj2021-year2021Grade>0) heighPlan++;
							}
    					}
    				}
    				
    				
    				
    				if(zyplan2023<zyadm2020) {//2021年招生比2023年人数多
    					
    					
    					
    					int seq=zyplan2023;//需要计算的录取名次，找到该录取名次对应的分数,2022年录取10人，2023年只找6人，则需要找出2022年录取第6名的成绩
						
						int yearSeq=0;//当年录取的名次
						int yearLastGrade=0;
						for(int u=0;u<majorGradeDetailList.size();u++) {
							SchoolMajorYearAdmission majorGradeDetail=majorGradeDetailList.get(u);
							if(majorGradeDetail.getYear()==2020&&majorGradeDetail.getMajorCode().equals(schoolPlan.getMajorCode())) {
								
								if(majorGradeDetail.getAdmission2()==null) {
									break;
								}
								
								
								
								yearSeq=yearSeq+majorGradeDetail.getAdmission2();
								if(yearSeq-zyplan2023<0) {
									yearLastGrade=majorGradeDetail.getGrade();
								}else if(yearSeq-zyplan2023==0) {
									year2020Grade=majorGradeDetail.getGrade();
									break;
								}else if(yearSeq-zyplan2023>0) {
									year2020Grade=yearLastGrade;
									break;
								}
							}
								
						}
    					
						if(year2020Grade>0) {
							admissionYears++;
							if(provinceName.equals("广西")) {//用广西同位分
								if(gxj2020-year2020Grade>0) heighPlan++;
							}else {//用全国同位分
								if(qgj2020-year2020Grade>0) heighPlan++;
							}
						}
						
    				}else {//2022年招生比2023年人数少，取2022年最后一名领取分作为名次对应的分数
    					int yearGrade=0;//当年录取名次上一个名次对应的分数
    					
    					for(int u=0;u<majorGradeDetailList.size();u++) {
							SchoolMajorYearAdmission majorGradeDetail=majorGradeDetailList.get(u);
							if(majorGradeDetail.getYear()==2020&&majorGradeDetail.getMajorCode().equals(schoolPlan.getMajorCode())) {
								
								if(majorGradeDetail.getAdmission2()==null) {
									break;
								}
								
								
								year2020Grade=majorGradeDetail.getGrade();//循环到最后一名，得到最后一名的分数
							}
    					}
    					if(year2020Grade>0) {
    						admissionYears++;
	    					if(provinceName.equals("广西")) {//用广西同位分
								if(gxj2020-year2020Grade>0) heighPlan++;
							}else {//用全国同位分
								if(qgj2020-year2020Grade>0) heighPlan++;
							}
    					}
    				}
    				
    				
    				double rate=0;
    				
    				if(admissionYears==3) {//有3年录取情况的，按55%，30%，15%比例分派
    					if(zyplan2023==zyplan2022&&zyplan2023==1) {
    						if(provinceName.equals("广西")) {//用广西同位分	  
    							rate=((qgj2022-year2022Grade)/2+50)*0.55+((qgj2021-year2021Grade)/2+50)*0.30+((qgj2020-year2020Grade)/2+50)*0.15;
    						}else {
    							rate=((qgj2022-year2022Grade)/2+50)*0.55+((qgj2021-year2021Grade)/2+50)*0.30+((qgj2020-year2020Grade)/2+50)*0.15;
    						}
    					}else {    				
    						if(heighPlan==3) {//三年同位分都高于	 排名分   					
	    						if(provinceName.equals("广西")) {//用广西同位分	    						
	        						rate=((gxj2022-year2022Grade)/2+80)*0.55+((gxj2021-year2021Grade)/2+80)*0.30+((gxj2020-year2020Grade)/2+80)*0.15;    						    						
	        					}else {//用全国同位分
	        						rate=((qgj2022-year2022Grade)/2+80)*0.55+((qgj2021-year2021Grade)/2+80)*0.30+((qgj2020-year2020Grade)/2+80)*0.15;  
	        					}
    						}else if(heighPlan==2) {//两年同位分都高于	 排名分
    							if(provinceName.equals("广西")) {//用广西同位分	
    								if(gxj2022-year2022Grade>0) {
    									double rate1=((gxj2022-year2022Grade)/2+70)*0.55;
    									rate=rate+rate1;
    								}else {
    									double rate1=((gxj2022-year2022Grade)/2+50)*0.55;
    									rate=rate+rate1;
    								}
    								if(gxj2021-year2021Grade>0) {
    									double rate1=((gxj2021-year2021Grade)/2+70)*0.3;
    									rate=rate+rate1;
    								}else {
    									double rate1=((gxj2021-year2021Grade)/2+50)*0.3;
    									rate=rate+rate1;
    								}
    								if(gxj2020-year2020Grade>0) {
    									double rate1=((gxj2020-year2020Grade)/2+70)*0.15;
    									rate=rate+rate1;
    								}else {
    									double rate1=((gxj2020-year2020Grade)/2+50)*0.15;
    									rate=rate+rate1;
    								}
    							}else {//用全国同位分
    								if(qgj2022-year2022Grade>0) {
    									double rate1=((qgj2022-year2022Grade)/2+70)*0.55;
    									rate=rate+rate1;
    								}else {
    									double rate1=((qgj2022-year2022Grade)/2+50)*0.55;
    									rate=rate+rate1;
    								}
    								if(qgj2021-year2021Grade>0) {
    									double rate1=((qgj2021-year2021Grade)/2+70)*0.3;
    									rate=rate+rate1;
    								}else {
    									double rate1=((qgj2021-year2021Grade)/2+50)*0.3;
    									rate=rate+rate1;
    								}
    								if(qgj2020-year2020Grade>0) {
    									double rate1=((qgj2020-year2020Grade)/2+70)*0.15;
    									rate=rate+rate1;
    								}else {
    									double rate1=((qgj2020-year2020Grade)/2+50)*0.15;
    									rate=rate+rate1;
    								}
    							}
    						}else if(heighPlan==1) {//一年高于
    							if(provinceName.equals("广西")) {//用广西同位分	
    								if(gxj2022-year2022Grade>0) {
    									double rate1=((gxj2022-year2022Grade)/2+60)*0.55;
    									rate=rate+rate1;
    								}else {
    									double rate1=((gxj2022-year2022Grade)/2+50)*0.55;
    									rate=rate+rate1;
    								}
    								if(gxj2021-year2021Grade>0) {
    									double rate1=((gxj2021-year2021Grade)/2+60)*0.3;
    									rate=rate+rate1;
    								}else {
    									double rate1=((gxj2021-year2021Grade)/2+50)*0.3;
    									rate=rate+rate1;
    								}
    								if(gxj2020-year2020Grade>0) {
    									double rate1=((gxj2020-year2020Grade)/2+60)*0.15;
    									rate=rate+rate1;
    								}else {
    									double rate1=((gxj2020-year2020Grade)/2+50)*0.15;
    									rate=rate+rate1;
    								}
    							}else {//用全国同位分
    								if(qgj2022-year2022Grade>0) {
    									double rate1=((qgj2022-year2022Grade)/2+60)*0.55;
    									rate=rate+rate1;
    								}else {
    									double rate1=((qgj2022-year2022Grade)/2+50)*0.55;
    									rate=rate+rate1;
    								}
    								if(qgj2021-year2021Grade>0) {
    									double rate1=((qgj2021-year2021Grade)/2+60)*0.3;
    									rate=rate+rate1;
    								}else {
    									double rate1=((qgj2021-year2021Grade)/2+50)*0.3;
    									rate=rate+rate1;
    								}
    								if(qgj2020-year2020Grade>0) {
    									double rate1=((qgj2020-year2020Grade)/2+60)*0.15;
    									rate=rate+rate1;
    								}else {
    									double rate1=((qgj2020-year2020Grade)/2+50)*0.15;
    									rate=rate+rate1;
    								}
    							}
    						}else {//3年都不高于
    							if(provinceName.equals("广西")) {//用广西同位分	    						
	        						rate=((gxj2022-year2022Grade)/2+50)*0.55+((gxj2021-year2021Grade)/2+50)*0.30+((gxj2020-year2020Grade)/2+50)*0.15;    						    						
	        					}else {//用全国同位分
	        						rate=((qgj2022-year2022Grade)/2+50)*0.55+((qgj2021-year2021Grade)/2+50)*0.30+((qgj2020-year2020Grade)/2+50)*0.15;  
	        					}
    						}	
    					}
	    			}else if(admissionYears==2) {//有2年录取情况的，按60%，40%比例分派
	    				if(zyplan2023==zyplan2022&&zyplan2023==1) {
	    					if(year2022Grade>0) {
	    						if(provinceName.equals("广西")) {//用广西同位分	
	    							double rate1=((gxj2022-year2022Grade)/2+50)*0.60;
	    							rate=rate+rate1;
	    							if(year2021Grade>0) {
	    								double rate2=((gxj2021-year2021Grade)/2+50)*0.40;
		    							rate=rate+rate2;
	    							}else {
	    								double rate2=((gxj2020-year2020Grade)/2+50)*0.40;
		    							rate=rate+rate2;
	    							}
	    						}else {//用全国同位分
	    							double rate1=((qgj2022-year2022Grade)/2+50)*0.60;
	    							rate=rate+rate1;
	    							if(year2021Grade>0) {
	    								double rate2=((qgj2021-year2021Grade)/2+50)*0.40;
		    							rate=rate+rate2;
	    							}else {
	    								double rate2=((qgj2020-year2020Grade)/2+50)*0.40;
		    							rate=rate+rate2;
	    							}
	    						}
	    					}else {//没有2022年录取数据
	    						if(provinceName.equals("广西")) {//用广西同位分	
	    							double rate1=((gxj2021-year2021Grade)/2+50)*0.60;
	    							rate=rate+rate1;
	    							
    								double rate2=((gxj2020-year2020Grade)/2+50)*0.40;
	    							rate=rate+rate2;
	    							
	    						}else {//用全国同位分
	    							double rate1=((qgj2021-year2021Grade)/2+50)*0.60;
	    							rate=rate+rate1;
	    							
    								double rate2=((qgj2020-year2020Grade)/2+50)*0.40;
	    							rate=rate+rate2;
	    						}
	    					}
	    				}else {	    					
	    					if(heighPlan==2) {//两年同位分都高于	 排名分
	    						if(year2022Grade>0) {
	    							if(provinceName.equals("广西")) {//用广西同位分	
	    								
    									double rate1=((gxj2022-year2022Grade)/2+70)*0.60;
    									rate=rate+rate1;
	    								
    									if(year2021Grade>0) {
    										double rate2=((gxj2021-year2021Grade)/2+70)*0.40;
        									rate=rate+rate2;
    									}else {
    										double rate2=((gxj2020-year2020Grade)/2+70)*0.40;
        									rate=rate+rate2;
    									}
	    							}else {
	    								double rate1=((qgj2022-year2022Grade)/2+70)*0.60;
    									rate=rate+rate1;
	    								
    									if(year2021Grade>0) {
    										double rate2=((qgj2021-year2021Grade)/2+70)*0.40;
        									rate=rate+rate2;
    									}else {
    										double rate2=((qgj2020-year2020Grade)/2+70)*0.40;
        									rate=rate+rate2;
    									}
	    							}
	    						}else {//没有2022年录取数据
	    							if(provinceName.equals("广西")) {//用广西同位分	
	    								double rate1=((gxj2021-year2021Grade)/2+70)*0.60;
    									rate=rate+rate1;
    									double rate2=((gxj2020-year2020Grade)/2+70)*0.40;
    									rate=rate+rate2;
	    							}else {
	    								double rate1=((qgj2021-year2021Grade)/2+70)*0.60;
    									rate=rate+rate1;
    									double rate2=((qgj2020-year2020Grade)/2+70)*0.40;
    									rate=rate+rate2;
	    							}
	    						}
	    					}else if(heighPlan==1) {//1年同位分都高于	 排名分
	    						if(provinceName.equals("广西")) {//用广西同位分
	    							if(year2022Grade>0) {
	    								double rate1=((gxj2022-year2022Grade)/2+60)*0.60;
    									rate=rate+rate1;
    									if(year2021Grade>0) {
    										double rate2=((gxj2021-year2021Grade)/2+60)*0.40;
        									rate=rate+rate2;
    									}else {
    										double rate2=((gxj2020-year2020Grade)/2+60)*0.40;
        									rate=rate+rate2;
    									}
	    							}else {
	    								double rate1=((gxj2021-year2021Grade)/2+60)*0.60;
    									rate=rate+rate1;
    									double rate2=((gxj2020-year2020Grade)/2+60)*0.40;
    									rate=rate+rate2;
	    							}
	    						}else {
	    							if(year2022Grade>0) {
	    								double rate1=((qgj2022-year2022Grade)/2+60)*0.60;
    									rate=rate+rate1;
    									if(year2021Grade>0) {
    										double rate2=((qgj2021-year2021Grade)/2+60)*0.40;
        									rate=rate+rate2;
    									}else {
    										double rate2=((qgj2020-year2020Grade)/2+60)*0.40;
        									rate=rate+rate2;
    									}
	    							}else {
	    								double rate1=((qgj2021-year2021Grade)/2+60)*0.60;
    									rate=rate+rate1;
    									double rate2=((qgj2020-year2020Grade)/2+60)*0.40;
    									rate=rate+rate2;
	    							}
	    						}
	    					}else {//0年同位分都高于	 排名分
	    						if(provinceName.equals("广西")) {//用广西同位分
	    							if(year2022Grade>0) {
	    								double rate1=((gxj2022-year2022Grade)/2+50)*0.60;
    									rate=rate+rate1;
    									if(year2021Grade>0) {
    										double rate2=((gxj2021-year2021Grade)/2+50)*0.40;
        									rate=rate+rate2;
    									}else {
    										double rate2=((gxj2020-year2020Grade)/2+50)*0.40;
        									rate=rate+rate2;
    									}
	    							}else {
	    								double rate1=((gxj2021-year2021Grade)/2+50)*0.60;
    									rate=rate+rate1;
    									double rate2=((gxj2020-year2020Grade)/2+50)*0.40;
    									rate=rate+rate2;
	    							}
	    						}else {
	    							if(year2022Grade>0) {
	    								double rate1=((qgj2022-year2022Grade)/2+50)*0.60;
    									rate=rate+rate1;
    									if(year2021Grade>0) {
    										double rate2=((qgj2021-year2021Grade)/2+50)*0.40;
        									rate=rate+rate2;
    									}else {
    										double rate2=((qgj2020-year2020Grade)/2+50)*0.40;
        									rate=rate+rate2;
    									}
	    							}else {
	    								double rate1=((qgj2021-year2021Grade)/2+50)*0.60;
    									rate=rate+rate1;
    									double rate2=((qgj2020-year2020Grade)/2+50)*0.40;
    									rate=rate+rate2;
	    							}
	    						}
	    					}
	    				}	
	    			}else if(admissionYears==1) {//有1年录取情况的
	    				if(provinceName.equals("广西")) {//用广西同位分
		    				if(year2022Grade>0) {
		    					double rate1=((gxj2022-year2022Grade)/2+50);
		    					rate=rate+rate1;
		    				}
		    				if(year2021Grade>0) {
		    					double rate1=((gxj2021-year2021Grade)/2+50);
		    					rate=rate+rate1;
		    				}
		    				if(year2020Grade>0) {
		    					double rate1=((gxj2020-year2020Grade)/2+50);
		    					rate=rate+rate1;
		    				}
	    				}else {
	    					if(year2022Grade>0) {
		    					double rate1=((qgj2022-year2022Grade)/2+50);
		    					rate=rate+rate1;
		    				}
		    				if(year2021Grade>0) {
		    					double rate1=((qgj2021-year2021Grade)/2+50);
		    					rate=rate+rate1;
		    				}
		    				if(year2020Grade>0) {
		    					double rate1=((qgj2020-year2020Grade)/2+50);
		    					rate=rate+rate1;
		    				}
	    				}
	    			}

    				
					// * * 招生数量对比占的概率
    				// * 1.当年招生数量，H是当年的招生数量，I是去年的招生数量
    				// * H＜20，（H-I）%=h
                    //   20＜=H＜50,（H-I）×0.5%=h。
                    //   50＜=H＜100,（H-I）×0.3%=h。
                    //   100＜=H,（H-I）×0.1%=h。
                    //   只有一个选择项，h最多为正负的30%。
					if(zyplan2023<10) {
						double rate2=zyplan2023-zyplan2022;
						if(rate2>30) rate2=30;
						if(rate2<-30) rate2=-30;
						rate=rate+rate2;
					}else if(zyplan2023>=10&&zyplan2023<50) {
						double rate2=(zyplan2023-zyplan2022)*0.5;
						if(rate2>30) rate2=30;
						if(rate2<-30) rate2=-30;
						rate=rate+rate2;
					}else if(zyplan2023>=50&&zyplan2023<100) {
						double rate2=(zyplan2023-zyplan2022)*0.3;
						if(rate2>30) rate2=30;
						if(rate2<-30) rate2=-30;
						rate=rate+rate2;
					}else if(zyplan2023>=100) {
						double rate2=(zyplan2023-zyplan2022)*0.1;
						if(rate2>30) rate2=30;
						if(rate2<-30) rate2=-30;
						rate=rate+rate2;
					}
					if(rate>=100) rate=99.99;
					if(rate<1) rate=1;
					schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
					schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
					schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
    				*/
    				
    				if(zyavgGrade2020>0&&zyavgGrade2021>0&&zyavgGrade2022>0) {//3年都有数据
    					if(provinceName.equals("广西")) {
    						if(gxj2020-zyavgGrade2020>0 &&gxj2021-zyavgGrade2021>0 &&gxj2022-zyavgGrade2022>0) {//3年的同位分都比录取平均分高
    							double rate=((gxj2022-zyavgGrade2022)/2+80)*0.55+((gxj2021-zyavgGrade2021)/2+80)*0.3+((gxj2020-zyavgGrade2020)/2+80)*0.15;
    							
    							/*
    							if(plan2023<10) {
    								double rate2=plan2023-plan2022;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=10&&plan2023<50) {
    								double rate2=(plan2023-plan2022)*0.5;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=50&&plan2023<100) {
    								double rate2=(plan2023-plan2022)*0.3;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=100) {
    								double rate2=(plan2023-plan2022)*0.1;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}
    							*/
    							if(rate>=100) rate=99.99;
    							if(rate<1) rate=1;
    							schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
    							schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
    							schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
    						}else {
    							double rate=0;
    							//2年高于
    							int count=0;
    							if(gxj2022-zyavgGrade2022>0) {
    								count++;
    							}
    							if(gxj2021-zyavgGrade2021>0) {
    								count++;
    							}
    							if(gxj2020-zyavgGrade2020>0) {
    								count++;
    							}
    							if(count==2) {//有2年高于同位分的
    								
    								if(gxj2022-zyavgGrade2022>0) {
    									rate=rate+((gxj2022-zyavgGrade2022)/2+70)*0.55;
    								}else {
    									rate=rate+((gxj2022-zyminGrade2022)/2+50)*0.55;
    								}
    								
    								if(gxj2021-zyavgGrade2021>0) {
    									rate=rate+((gxj2021-zyavgGrade2021)/2+70)*0.3;
    								}else {
    									rate=rate+((gxj2021-zyminGrade2021)/2+50)*0.3;
    								}
    								
    								if(gxj2020-zyavgGrade2020>0) {
    									rate=rate+((gxj2020-zyavgGrade2020)/2+70)*0.15;
    								}else {
    									rate=rate+((gxj2020-zyminGrade2020)/2+50)*0.15;
    								}
    							}else if(count==1) {//有1年高于同位分的
    								
    								if(gxj2022-zyavgGrade2022>0) {
    									rate=rate+((gxj2022-zyavgGrade2022)/2+60)*0.55;
    								}else {
    									rate=rate+((gxj2022-zyminGrade2022)/2+50)*0.55;
    								}
    								
    								if(gxj2021-zyavgGrade2021>0) {
    									rate=rate+((gxj2021-zyavgGrade2021)/2+60)*0.3;
    								}else {
    									rate=rate+((gxj2021-zyminGrade2021)/2+50)*0.3;
    								}
    								
    								if(gxj2020-zyavgGrade2020>0) {
    									rate=rate+((gxj2020-zyavgGrade2020)/2+60)*0.15;
    								}else {
    									rate=rate+((gxj2020-zyminGrade2020)/2+50)*0.15;
    								}
    								
    							}else {//一个高于的都没有
    								rate=((gxj2022-zyminGrade2022)/2+50)*0.55+((gxj2021-zyminGrade2021)/2+50)*0.3+((gxj2020-zyminGrade2020)/2+50)*0.15;
    							}

    							
    							/*
    							if(plan2023<10) {
    								double rate2=plan2023-plan2022;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=10&&plan2023<50) {
    								double rate2=(plan2023-plan2022)*0.5;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=50&&plan2023<100) {
    								double rate2=(plan2023-plan2022)*0.3;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=100) {
    								double rate2=(plan2023-plan2022)*0.1;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}
    							*/
    							if(rate>=100) rate=99.99;
    							if(rate<1) rate=1;
    							schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
								schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
								schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));			
    						}
    					}else {//全国学校，用全国同位分
    						if(qgj2020-zyavgGrade2020>0 &&qgj2021-zyavgGrade2021>0 &&qgj2022-zyavgGrade2022>0) {//3年的同位分都比录取平均分高
    							double rate=((qgj2022-zyavgGrade2022)/2+80)*0.55+((qgj2021-zyavgGrade2021)/2+80)*0.3+((qgj2020-zyavgGrade2020)/2+80)*0.15;
    							/*
    							if(plan2023<10) {
    								double rate2=plan2023-plan2022;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=10&&plan2023<50) {
    								double rate2=(plan2023-plan2022)*0.5;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=50&&plan2023<100) {
    								double rate2=(plan2023-plan2022)*0.3;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=100) {
    								double rate2=(plan2023-plan2022)*0.1;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}
    							*/
    							if(rate>=100) rate=99.99;
    							if(rate<1) rate=1;
    							schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
    							schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
    							schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
    						}else {
    							double rate=0;
    							//2年高于
    							int count=0;
    							if(qgj2022-zyavgGrade2022>0) {
    								count++;
    							}
    							if(qgj2021-zyavgGrade2021>0) {
    								count++;
    							}
    							if(qgj2020-zyavgGrade2020>0) {
    								count++;
    							}
    							if(count==2) {//有2年高于同位分的
    								
    								if(qgj2022-zyavgGrade2022>0) {
    									rate=rate+((qgj2022-zyavgGrade2022)/2+70)*0.55;
    								}else {
    									rate=rate+((qgj2022-zyminGrade2022)/2+50)*0.55;
    								}
    								
    								if(qgj2021-zyavgGrade2021>0) {
    									rate=rate+((qgj2021-zyavgGrade2021)/2+70)*0.3;
    								}else {
    									rate=rate+((qgj2021-zyminGrade2021)/2+50)*0.3;
    								}
    								
    								if(qgj2020-zyavgGrade2020>0) {
    									rate=rate+((qgj2020-zyavgGrade2020)/2+70)*0.15;
    								}else {
    									rate=rate+((qgj2020-zyminGrade2020)/2+50)*0.15;
    								}
    							}else if(count==1) {//有1年高于同位分的
    								
    								if(qgj2022-zyavgGrade2022>0) {
    									rate=rate+((qgj2022-zyavgGrade2022)/2+60)*0.55;
    								}else {
    									rate=rate+((qgj2022-zyminGrade2022)/2+50)*0.55;
    								}
    								
    								if(qgj2021-zyavgGrade2021>0) {
    									rate=rate+((qgj2021-zyavgGrade2021)/2+60)*0.3;
    								}else {
    									rate=rate+((qgj2021-zyminGrade2021)/2+50)*0.3;
    								}
    								
    								if(qgj2020-zyavgGrade2020>0) {
    									rate=rate+((qgj2020-zyavgGrade2020)/2+60)*0.15;
    								}else {
    									rate=rate+((qgj2020-zyminGrade2020)/2+50)*0.15;
    								}
    								
    							}else {//一个高于的都没有
    								rate=((qgj2022-zyminGrade2022)/2+50)*0.55+((qgj2021-zyminGrade2021)/2+50)*0.3+((qgj2020-zyminGrade2020)/2+50)*0.15;
    							}
    							
    							/*
    							if(plan2023<10) {
    								double rate2=plan2023-plan2022;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=10&&plan2023<50) {
    								double rate2=(plan2023-plan2022)*0.5;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=50&&plan2023<100) {
    								double rate2=(plan2023-plan2022)*0.3;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}else if(plan2023>=100) {
    								double rate2=(plan2023-plan2022)*0.1;
    								if(rate2>30) rate2=30;
    								if(rate2<-30) rate2=-30;
    								rate=rate+rate2;
    							}
    							*/
    							if(rate>=100) rate=99.99;
    							if(rate<1) rate=1;
    							schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
    							schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
    							schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));  						
    						}
    					}
    				}else {//数据不满3年
    					int years=0;
    					if(zyavgGrade2020>0) years++;
    					if(zyavgGrade2021>0) years++;
    					if(zyavgGrade2022>0) years++;
    					if(years==2) {
    						double rate=0;
    						if(provinceName.equals("广西")) {
    							int heightYears=0;//这两年中，同位分大于平均分的年份数=2，则+70，如果年份数=1，则+60，都不大于平均分，则+50
        						if(zyavgGrade2022>0&&gxj2022-zyavgGrade2022>0) heightYears++;
        						if(zyavgGrade2021>0&&gxj2021-zyavgGrade2021>0) heightYears++;
        						if(zyavgGrade2020>0&&gxj2020-zyavgGrade2020>0) heightYears++;
    							
    							if(zyavgGrade2022>0) {//2022年有数据
    								if(heightYears==2) {
    									double rate1=((gxj2022-zyavgGrade2022)/2+70)*0.60;
        								rate=rate+rate1;
        								
        								if(zyavgGrade2021>0) {
            								double rate2=((gxj2021-zyavgGrade2021)/2+70)*0.40;
            								rate=rate+rate2;
            							}else {
            								double rate2=((gxj2020-zyavgGrade2020)/2+70)*0.40;
            								rate=rate+rate2;
            							}
    								}else if(heightYears==1) {
    									if(gxj2022-zyavgGrade2022>0) {
    										double rate1=((gxj2022-zyavgGrade2022)/2+60)*0.60;
            								rate=rate+rate1;
    									}else {
    										double rate1=((gxj2022-zyminGrade2022)/2+50)*0.60;
            								rate=rate+rate1;
    									}
    									if(zyavgGrade2021>0) {
        									if(gxj2021-zyavgGrade2021>0) {
        										double rate1=((gxj2021-zyavgGrade2021)/2+60)*0.40;
                								rate=rate+rate1;
        									}else {
        										double rate1=((gxj2021-zyminGrade2021)/2+60)*0.40;
                								rate=rate+rate1;
        									}
    									}else {
    										if(gxj2020-zyavgGrade2020>0) {
        										double rate1=((gxj2020-zyavgGrade2020)/2+60)*0.40;
                								rate=rate+rate1;
        									}else {
        										double rate1=((gxj2020-zyminGrade2020)/2+60)*0.40;
                								rate=rate+rate1;
        									}
    									}
    								}else {//都不高于平均分
    									double rate1=((gxj2022-zyminGrade2022)/2+50)*0.60;
        								rate=rate+rate1;
        								if(zyavgGrade2021>0) {
        									double rate2=((gxj2021-zyminGrade2021)/2+50)*0.60;
            								rate=rate+rate2;
        								}else {
        									double rate2=((gxj2020-zyminGrade2020)/2+50)*0.40;
            								rate=rate+rate2;
        								}
    								}
    							}else {//2022年没数据，只有2021和2020年数据
    								if(heightYears==2) {
    									double rate1=((gxj2021-zyavgGrade2021)/2+70)*0.60+((gxj2020-zyavgGrade2020)/2+70)*0.40;
    									rate=rate+rate1;
    								}else if(heightYears==1) {
    									if(gxj2021-zyavgGrade2021>0) {
    										double rate1=((gxj2021-zyavgGrade2021)/2+60)*0.60;
    										rate=rate+rate1;
    									}else {
    										double rate1=((gxj2021-minGrade2021)/2+50)*0.60;
    										rate=rate+rate1;
    									}
    									if(gxj2020-zyavgGrade2020>0) {
    										double rate1=((gxj2020-zyavgGrade2020)/2+60)*0.40;
    										rate=rate+rate1;
    									}else {
    										double rate1=((gxj2020-zyminGrade2020)/2+50)*0.40;
    										rate=rate+rate1;
    									}
    								}else {
    									double rate1=((gxj2021-zyminGrade2021)/2+50)*0.60;
        								rate=rate+rate1;
            							
        								double rate2=((gxj2020-zyminGrade2020)/2+50)*0.40;
        								rate=rate+rate2;
    								}
    							}
    						}else {//只有2年数据，全国的
    							int heightYears=0;//这两年中，同位分大于平均分的年份数=2，则+70，如果年份数=1，则+60，都不大于平均分，则+50
        						if(zyavgGrade2022>0&&qgj2022-zyavgGrade2022>0) heightYears++;
        						if(zyavgGrade2021>0&&qgj2021-zyavgGrade2021>0) heightYears++;
        						if(zyavgGrade2020>0&&qgj2020-zyavgGrade2020>0) heightYears++;
    							
    							if(zyavgGrade2022>0) {//2022年有数据
    								if(heightYears==2) {
    									double rate1=((qgj2022-zyavgGrade2022)/2+70)*0.60;
        								rate=rate+rate1;
        								
        								if(zyavgGrade2021>0) {
            								double rate2=((qgj2021-zyavgGrade2021)/2+70)*0.40;
            								rate=rate+rate2;
            							}else {
            								double rate2=((qgj2020-zyavgGrade2020)/2+70)*0.40;
            								rate=rate+rate2;
            							}
    								}else if(heightYears==1) {
    									if(qgj2022-zyavgGrade2022>0) {
    										double rate1=((qgj2022-zyavgGrade2022)/2+60)*0.60;
            								rate=rate+rate1;
    									}else {
    										double rate1=((qgj2022-zyminGrade2022)/2+50)*0.60;
            								rate=rate+rate1;
    									}
    									if(zyavgGrade2021>0) {
        									if(qgj2021-zyavgGrade2021>0) {
        										double rate1=((qgj2021-zyavgGrade2021)/2+60)*0.40;
                								rate=rate+rate1;
        									}else {
        										double rate1=((qgj2021-zyminGrade2021)/2+60)*0.40;
                								rate=rate+rate1;
        									}
    									}else {
    										if(qgj2020-zyavgGrade2020>0) {
        										double rate1=((qgj2020-zyavgGrade2020)/2+60)*0.40;
                								rate=rate+rate1;
        									}else {
        										double rate1=((qgj2020-zyminGrade2020)/2+60)*0.40;
                								rate=rate+rate1;
        									}
    									}
    								}else {//都不高于平均分
    									double rate1=((qgj2022-zyminGrade2022)/2+50)*0.60;
        								rate=rate+rate1;
        								if(zyavgGrade2021>0) {
        									double rate2=((qgj2021-zyminGrade2021)/2+50)*0.60;
            								rate=rate+rate2;
        								}else {
        									double rate2=((qgj2020-zyminGrade2020)/2+50)*0.40;
            								rate=rate+rate2;
        								}
    								}
    							}else {//2022年没数据，只有2021和2020年数据
    								if(heightYears==2) {
    									double rate1=((qgj2021-zyavgGrade2021)/2+70)*0.60+((qgj2020-zyavgGrade2020)/2+70)*0.40;
    									rate=rate+rate1;
    								}else if(heightYears==1) {
    									if(qgj2021-zyavgGrade2021>0) {
    										double rate1=((qgj2021-zyavgGrade2021)/2+60)*0.60;
    										rate=rate+rate1;
    									}else {
    										double rate1=((qgj2021-zyminGrade2021)/2+50)*0.60;
    										rate=rate+rate1;
    									}
    									if(qgj2020-zyavgGrade2020>0) {
    										double rate1=((qgj2020-zyavgGrade2020)/2+60)*0.40;
    										rate=rate+rate1;
    									}else {
    										double rate1=((qgj2020-zyminGrade2020)/2+50)*0.40;
    										rate=rate+rate1;
    									}
    								}else {
    									double rate1=((qgj2021-zyminGrade2021)/2+50)*0.60;
        								rate=rate+rate1;
            							
        								double rate2=((qgj2020-zyminGrade2020)/2+50)*0.40;
        								rate=rate+rate2;
    								}
    							}
    							
    						}
    						
    						/*
    						if(plan2023<10) {
    							double rate2=plan2023-plan2022;
    							if(rate2>30) rate2=30;
    							if(rate2<-30) rate2=-30;
    							rate=rate+rate2;
    						}else if(plan2023>=10&&plan2023<50) {
    							double rate2=(plan2023-plan2022)*0.5;
    							if(rate2>30) rate2=30;
    							if(rate2<-30) rate2=-30;
    							rate=rate+rate2;
    						}else if(plan2023>=50&&plan2023<100) {
    							double rate2=(plan2023-plan2022)*0.3;
    							if(rate2>30) rate2=30;
    							if(rate2<-30) rate2=-30;
    							rate=rate+rate2;
    						}else if(plan2023>=100) {
    							double rate2=(plan2023-plan2022)*0.1;
    							if(rate2>30) rate2=30;
    							if(rate2<-30) rate2=-30;
    							rate=rate+rate2;
    						}
    						*/
    						if(rate>=100) rate=99.99;
    						if(rate<1) rate=1;
    						schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
							schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
							schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
    					}else {//只有一年数据
    						if(provinceName.equals("广西")) {

        						if(zyavgGrade2022>0) {
    								double rate=((gxj2022-zyminGrade2022)/2)+50;
    								
    								if(plan2023<10) {
        								double rate2=plan2023-plan2022;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}else if(plan2023>=10&&plan2023<50) {
        								double rate2=(plan2023-plan2022)*0.5;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}else if(plan2023>=50&&plan2023<100) {
        								double rate2=(plan2023-plan2022)*0.3;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}else if(plan2023>=100) {
        								double rate2=(plan2023-plan2022)*0.1;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}
    								if(rate>=100) rate=99.99;
    								if(rate<1) rate=1;
    								schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
    								schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
    								schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
    							}
        						if(zyavgGrade2021>0) {
    								double rate=((gxj2021-zyminGrade2021)/2)+50;
    								/*
    								if(plan2023<10) {
        								double rate2=plan2023-plan2022;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}else if(plan2023>=10&&plan2023<50) {
        								double rate2=(plan2023-plan2022)*0.5;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}else if(plan2023>=50&&plan2023<100) {
        								double rate2=(plan2023-plan2022)*0.3;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}else if(plan2023>=100) {
        								double rate2=(plan2023-plan2022)*0.1;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}
        							*/
    								if(rate>=100) rate=99.99;
    								if(rate<1) rate=1;
    								schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
    								schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
    								schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
    							}
        						if(zyavgGrade2020>0) {
    								double rate=((gxj2020-zyminGrade2020)/2)+50;
    								/*
    								if(plan2023<10) {
        								double rate2=plan2023-plan2022;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}else if(plan2023>=10&&plan2023<50) {
        								double rate2=(plan2023-plan2022)*0.5;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}else if(plan2023>=50&&plan2023<100) {
        								double rate2=(plan2023-plan2022)*0.3;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}else if(plan2023>=100) {
        								double rate2=(plan2023-plan2022)*0.1;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}
        							*/
    								if(rate>=100) rate=99.99;
    								if(rate<1) rate=1;
    								schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
    								schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
    								schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
    							}
    						}else {//全国只有一年数据
    							if(zyavgGrade2022>0) {
    								double rate=((qgj2022-zyminGrade2022)/2)+50;
    								/*
    								if(plan2023<10) {
        								double rate2=plan2023-plan2022;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}else if(plan2023>=10&&plan2023<50) {
        								double rate2=(plan2023-plan2022)*0.5;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}else if(plan2023>=50&&plan2023<100) {
        								double rate2=(plan2023-plan2022)*0.3;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}else if(plan2023>=100) {
        								double rate2=(plan2023-plan2022)*0.1;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}
        							*/
    								if(rate>=100) rate=99.99;
    								if(rate<1) rate=1;
    								schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
    								schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
    								schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
    							}
        						if(zyavgGrade2021>0) {
    								double rate=((qgj2021-zyminGrade2021)/2)+50;
    								/*
    								if(plan2023<10) {
        								double rate2=plan2023-plan2022;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}else if(plan2023>=10&&plan2023<50) {
        								double rate2=(plan2023-plan2022)*0.5;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}else if(plan2023>=50&&plan2023<100) {
        								double rate2=(plan2023-plan2022)*0.3;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}else if(plan2023>=100) {
        								double rate2=(plan2023-plan2022)*0.1;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}
        							*/
    								if(rate>=100) rate=99.99;
    								if(rate<1) rate=1;
    								schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
    								schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
    								schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
    							}
        						if(zyavgGrade2020>0) {
    								double rate=((qgj2020-zyminGrade2020)/2)+50;
    								/*
    								if(plan2023<10) {
        								double rate2=plan2023-plan2022;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}else if(plan2023>=10&&plan2023<50) {
        								double rate2=(plan2023-plan2022)*0.5;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}else if(plan2023>=50&&plan2023<100) {
        								double rate2=(plan2023-plan2022)*0.3;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}else if(plan2023>=100) {
        								double rate2=(plan2023-plan2022)*0.1;
        								if(rate2>30) rate2=30;
        								if(rate2<-30) rate2=-30;
        								rate=rate+rate2;
        							}
        							*/
    								if(rate>=100) rate=99.99;
    								if(rate<1) rate=1;
    								schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
    								schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
    								schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
    							}
    						}
    					}
    				}

					/*
					专业的录取概率:(今年的院校专业组投档概率X80%+现在系统显示的录取概率Ⅹ20%）
					 */
					for(int s=0;s<plans2024List.size();s++){
						SchoolPlan plan2024= plans2024List.get(s);
						//学校和专业组相等
						if(plan2024.getSchoolCode().equals(schoolMajorYearAdmission2022.getsCode())
								&&plan2024.getZyz().equals(schoolMajorYearAdmission2022.getZyz())){
							//最低录取分数线
							int grade=plan2024.getGrade();
							int memberGrade=memberQuery.getGrade();
							if(schoolMajorYearAdmission2022.getSubmitRate()!=null) {
								double rate=new Double(schoolMajorYearAdmission2022.getSubmitRate());
								//((考生成绩-录取最低分)/2+50)*0.8+schoolRecord2022.getSubmitRate()*0.2
								double finalRate = ((memberGrade - grade) / 2 + 50) * 0.8 + rate * 0.2;

								if(finalRate>=100) finalRate=99.99;
								if(finalRate<1) finalRate=1;
								schoolMajorYearAdmission2022.setSubmitRate(df.format(finalRate));
								schoolMajorYearAdmission2022.setSubmitRate(df.format(finalRate));
								schoolMajorYearAdmission2022.setSubmitRate(df.format(finalRate));
							}

						}
					}
    				
    				
    				if(schoolMajorYearAdmission2022.getSubmitRate()==null) {
    					schoolMajorYearAdmission2022.setSubmitRate("-");
    				}
    				
    				if(schoolMajorYearAdmission2022.getPlanSubmitAdmission()==null) {
    					schoolMajorYearAdmission2022.setPlanSubmitAdmission("-");
    				}
    				
    				if(schoolMajorYearAdmission2022.getAvgGradeSeq()==null||schoolMajorYearAdmission2022.getAvgGradeSeq().equals("99999999")) {
    					schoolMajorYearAdmission2022.setAvgGradeSeq("-");
    				}
    				
    				if(schoolMajorYearAdmission2022.getMinGradeSeq()==null||schoolMajorYearAdmission2022.getMinGradeSeq().equals("99999999")) {
    					schoolMajorYearAdmission2022.setMinGradeSeq("-");
    				}
    				
    				if(schoolMajorYearAdmission2021.getSubmitRate()==null) {
    					schoolMajorYearAdmission2021.setSubmitRate("-");
    					
    				}
    				if(schoolMajorYearAdmission2021.getPlanSubmitAdmission()==null) {
    					schoolMajorYearAdmission2021.setPlanSubmitAdmission("-");
    				}
    				
    				
    				if(schoolMajorYearAdmission2021.getAvgGradeSeq()==null||schoolMajorYearAdmission2021.getAvgGradeSeq().equals("99999999")) {
    					schoolMajorYearAdmission2021.setAvgGradeSeq("-");
    				}
    				
    				if(schoolMajorYearAdmission2021.getMinGradeSeq()==null||schoolMajorYearAdmission2021.getMinGradeSeq().equals("99999999")) {
    					schoolMajorYearAdmission2021.setMinGradeSeq("-");
    				}
    				
    				if(schoolMajorYearAdmission2020.getSubmitRate()==null) {
    					schoolMajorYearAdmission2020.setSubmitRate("-");
    				}
    				if(schoolMajorYearAdmission2020.getPlanSubmitAdmission()==null) {
    					schoolMajorYearAdmission2020.setPlanSubmitAdmission("-");
    				}
    				
    				if(schoolMajorYearAdmission2022.getMajorPlan()==null) {
    					schoolMajorYearAdmission2022.setMajorPlan(9999);
    				}
    				
    				if(schoolMajorYearAdmission2021.getMajorPlan()==null) {
    					schoolMajorYearAdmission2021.setMajorPlan(9999);
    				}
    				
    				if(schoolMajorYearAdmission2020.getMajorPlan()==null) {
    					schoolMajorYearAdmission2020.setMajorPlan(9999);
    				}
    				
    				if(schoolMajorYearAdmission2020.getAvgGradeSeq()==null||schoolMajorYearAdmission2020.getAvgGradeSeq().equals("99999999")) {
    					schoolMajorYearAdmission2020.setAvgGradeSeq("-");
    				}
    				
    				if(schoolMajorYearAdmission2020.getMinGradeSeq()==null||schoolMajorYearAdmission2020.getMinGradeSeq().equals("99999999")) {
    					schoolMajorYearAdmission2020.setMinGradeSeq("-");
    				}
    				
    				zyList.add(schoolMajorYearAdmission2022);
    				zyList.add(schoolMajorYearAdmission2021);
    				zyList.add(schoolMajorYearAdmission2020);
    				
    				map.put("zyList", zyList);
    				
    				
    				
    				
    				
	        		
	        	}
	        	
	        	
	        	
	        	
	        	
	        	
	        	
        	}
        	
        	
        }else {
        	return AjaxResult.error("找不到学校信息");
        }
    	
    	
    	return AjaxResult.success(map);
    }
    
    
    
    /************
     * 
     * @param schoolCode
     * @param zyz
     * @param userId
     * @return
     * 返回内容为：
     * 1个school对象
     * 1个专业组数组
     * 第一个专业组的投档概率（3条记录）
     * 第一个专业组下个专业的投档概率（每个专业3条记录）
     */
    @ApiOperation("根据专业组显示综合分析详情")
    @GetMapping("/showByZyz")
    public AjaxResult showByZyz(String schoolCode,String zyz,String userId)
    {
    	
    	if(userId==null||userId.equals("")) {
    		return AjaxResult.error("请先登录");
    	}
    	
    	if(isSpecialChar(userId.toString())||sqlValidate(userId.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	BuzMember memberQuery=buzMemberService.selectBuzMemberById(userId);

    	if(memberQuery!=null&&memberQuery.getPhone()!=null) {
    		
    	}else {
    		
    		return AjaxResult.error("会员信息不存在，请先注册成为会员");
    	}
    	
    	if(memberQuery.getSfvip().intValue()==0) {
        	return AjaxResult.error("系统已更新，非会员不能查询");
        }
    	
    	if(schoolCode==null||schoolCode.trim().equals("")) {
    		return AjaxResult.error("请选择学校");
    	}
    	
    	if(zyz==null||zyz.trim().equals("")) {
    		return AjaxResult.error("请选择专业组");
    	}
    	
    	if(isSpecialChar(schoolCode.toString())||sqlValidate(schoolCode.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	if(isSpecialChar(zyz.toString())||sqlValidate(zyz.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}


		//查找会员的同位分
		BuzMemberGrade memberGradeQuery=new BuzMemberGrade();
		memberGradeQuery.setMemberId(memberQuery.getId());
		List<BuzMemberGrade> memberGradeList=buzMemberGradeService.selectBuzMemberGradeList(memberGradeQuery);


    	
    	Map map=new HashMap();
    	
    	
    	School schoolQuery=new School();
        
        
        if("物理".equals(memberQuery.getSxkm())) {
        	schoolQuery.setMajorType("理工类");
    	}
    	if("历史".equals(memberQuery.getSxkm())) {
    		schoolQuery.setMajorType("文史类");
    	}
    	
    	//如果会员不是少数民族，则不能查询民族班
    	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
    		schoolQuery.setSsmzFlag(0);
    	}
    	
    	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
    		schoolQuery.setGjzxFlag(0);
    	}
    	
    	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
    		schoolQuery.setGxzxFlag(0);
    	}
    	
    	//考生的再选科目
    	schoolQuery.setZxkm(memberQuery.getZxkm());   
        
    	schoolQuery.setScode(schoolCode);
                
        int pageRow=0;
        
        schoolQuery.setPageNum(pageRow);
        
        
        
        
        List<School> list = schoolService.selectSchoolList4Page(schoolQuery);
        if(list!=null&&list.size()>0) {
        	School school=list.get(0);
        	
        	

        	
        	String provinceName=school.getProvinceName();
        	
        	
        	schoolCode="'"+schoolCode+"'";
        	
        	//查询专业组
        	SchoolPlan schoolPlanQuery=new SchoolPlan();
        	schoolPlanQuery.setYear(thisYear);
        	schoolPlanQuery.setSchoolCode(schoolCode);
        	if("物理".equals(memberQuery.getSxkm())) {
        		schoolPlanQuery.setMajorType("理工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		schoolPlanQuery.setMajorType("文史类");
        	}
        	
        	
        	//如果会员不是少数民族，则不能查询民族班
        	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
        		schoolPlanQuery.setSsmzFlag(0);
        	}
        	
        	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
        		schoolPlanQuery.setGjzxFlag(0);
        	}
        	
        	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
        		schoolPlanQuery.setGxzxFlag(0);
        	}
        	
        	//考生的再选科目
        	schoolPlanQuery.setZxkm(memberQuery.getZxkm());
        	
        	schoolPlanQuery.setZyz(zyz);
			List<SchoolPlan> zyzTabList =schoolPlanService.selectSchoolZyzPlanList(schoolPlanQuery);

			SchoolPlan zyzPlan = null;
			if(zyzTabList!=null&&zyzTabList.size()>0) {
				if(zyz!=null&&!zyz.equals("")){
					for(int i=0;i<zyzTabList.size();i++){
						SchoolPlan plan=zyzTabList.get(i);
						if(zyz.equals(plan.getZyz())){
							zyzPlan =plan;
						}
					}
				}else{
					zyzPlan=zyzTabList.get(0);
				}
			}



			school.setZyz(zyzPlan.getZyz());
			if(zyzPlan.getZyzPlan()!=null) {
				school.setPlan(zyzPlan.getZyzPlan().toString());
			}else{
				school.setPlan("-");
			}
			map.put("school", school);


			List<SchoolPlan> plans2024List =schoolPlanService.selectSchoolZyz2024PlanList(schoolPlanQuery);


			//专业组近3年的数据
			schoolPlanQuery.setYear3(yearNew1+","+yearNew2+","+yearNew3);
			schoolPlanQuery.setZyz(zyzPlan.getZyz());
			List<SchoolPlan> zyzList =schoolPlanService.selectSchoolZyzPlanList3Year(schoolPlanQuery);

			//该专业组下的所有专业近3年的数据
			List<SchoolPlan> majorList =schoolPlanService.selectSchoolMajorList3Year(schoolPlanQuery);
			//有些专业的数据并不是近3年都有，所以需要去重后，以这个专业作为循环
			//之前做错了，要以2024年的这个专业组下的专业的作为专业循环
			schoolPlanQuery.setYear3(new Integer(thisYear).toString());
			List<SchoolPlan> distinctMajorList =schoolPlanService.selectSchoolDistinctMajorList3Year(schoolPlanQuery);



			String memo="您是"+thisYear+"的考生，您的科目组是"+memberQuery.getSxkm()+"+"+memberQuery.getZxkm()+"，"
					+"您的高考总分为"+memberQuery.getQggrade()+"（区外院校排名"+memberQuery.getGradePm()
					+"，区内院校排名"+memberQuery.getGradePmGx()+"）。今年"
					+memberQuery.getSxkm()+"类本科分数线是";
			if("物理".equals(memberQuery.getSxkm())) {
				memo=memo+thisYearLgGradeLine+"分（区外排名"+thisYearLgQgpm
						+"，区内排名"+thisYearLgGxpm+"），分析到区外或广西区内院校时，系统会自动转换名次来分析。该院校专业组今年的招生计划数为";
			}else{
				memo=memo+thisYearWsGradeLine+"分（区外排名"+thisYearWsQgpm
						+"，区内排名"+thisYearWsGxpm+"），分析到区外或广西区内院校时，系统会自动转换名次来分析。该院校专业组今年的招生计划数为";
			}
			memo=memo+zyzPlan.getZyzPlan()+"，您的院校专业组投档概率及专业录取概率分析如下:";

			memberQuery.setMemo(memo);
        	
        	//专业组投档概率
        	List<School> returnList =new ArrayList();
        	
        	
        	DecimalFormat df = new DecimalFormat("#.00");


			zyz=zyzPlan.getZyz();


			//当年招生数量，从招生计划取
			int plan2023=0;

			School schoolRecord2022=new School();
			schoolRecord2022.setProvinceName(provinceName);
			schoolRecord2022.setSname(school.getSname());
			schoolRecord2022.setScode(school.getScode());
			schoolRecord2022.setZyz(zyz);
			schoolRecord2022.setZxkm(zyzPlan.getKm2());
			schoolRecord2022.setYear(yearNew1);
			schoolRecord2022.setSranking(school.getSranking());

			if("物理".equals(memberQuery.getSxkm())) {
				schoolRecord2022.setGradeLine(new Integer(gradeLineLg2022).toString());
			}else{
				schoolRecord2022.setGradeLine(new Integer(gradeLineWs2022).toString());
			}

			/**
			 * 计算当年的排名和对应的分数
			 */
			if(provinceName.equals("广西")) {

				if(memberGradeList!=null&&memberGradeList.size()>0){
					for(int k=0;k<memberGradeList.size();k++){
						BuzMemberGrade memberGrade=memberGradeList.get(k);
						if(memberGrade.getYear().intValue()==yearNew1){
							if(memberGrade.getPmGradeGx()!=null) {
								schoolRecord2022.setSeqGrade(memberGrade.getPmGradeGx().toString());
							}else{
								schoolRecord2022.setSeqGrade("-");
							}
						}
					}
				}

				if(memberQuery.getGradePmGx()!=null) {
					schoolRecord2022.setSeq(memberQuery.getGradePmGx().toString());
				}else{
					schoolRecord2022.setSeq("-");
				}
			}else {

				if(memberGradeList!=null&&memberGradeList.size()>0){
					for(int k=0;k<memberGradeList.size();k++){
						BuzMemberGrade memberGrade=memberGradeList.get(k);
						if(memberGrade.getYear().intValue()==yearNew1){
							if(memberGrade.getPmGradeGx()!=null) {
								schoolRecord2022.setSeqGrade(memberGrade.getPmGrade().toString());
							}else{
								schoolRecord2022.setSeqGrade("-");
							}
						}
					}
				}

				if(memberQuery.getGradePm()!=null) {
					schoolRecord2022.setSeq(memberQuery.getGradePm().toString());
				}else{
					schoolRecord2022.setSeq("-");
				}

			}

			/**
			 * 计算当年最低分，最低分排名，平均分，平均分对应的排名
			 */
			SchoolPlan zyz2022=null;
			for(int k=0;k<zyzList.size();k++) {
				SchoolPlan school3 = zyzList.get(k);
				if (school3.getYear().intValue() == yearNew1 &&
						school3.getSchoolCode().equals(school.getScode()) &&
						school3.getZyz().equals(school.getZyz())) {
					zyz2022=school3;
					break;

				}
			}
			if(zyz2022!=null){
				if(zyz2022.getZyzAvgGrade()!=null){
					schoolRecord2022.setAvgGrade(zyz2022.getZyzAvgGrade().toString());
				}else{
					schoolRecord2022.setAvgGrade("-");
				}
				if(zyz2022.getZyzLowGrade()!=null){
					schoolRecord2022.setMinGrade(zyz2022.getZyzLowGrade().toString());
				}else{
					schoolRecord2022.setMinGrade("-");
				}
				if(zyz2022.getZyzLowPm()!=null){
					schoolRecord2022.setMinGradeSeq(zyz2022.getZyzLowPm().toString());
				}else{
					schoolRecord2022.setMinGradeSeq("-");
				}
				if(zyz2022.getZyzAvgPm()!=null){
					schoolRecord2022.setAvgGradeSeq(zyz2022.getZyzAvgPm().toString());
				}else{
					schoolRecord2022.setAvgGradeSeq("-");
				}
				String planSubmitAdmission="";
				if(zyz2022.getZyzPlan()!=null){
					schoolRecord2022.setPlan(zyz2022.getZyzPlan().toString());
					planSubmitAdmission=zyz2022.getZyzPlan().toString();
				}else{
					schoolRecord2022.setPlan("-");
				}
				if(zyz2022.getZyzAdmin()!=null){
					schoolRecord2022.setSubmit(zyz2022.getZyzAdmin().toString());
					planSubmitAdmission=planSubmitAdmission+"-"+zyz2022.getZyzAdmin().toString();
				}else{
					schoolRecord2022.setSubmit("-");
					if(zyz2022.getZyzPlan()!=null){
						planSubmitAdmission=planSubmitAdmission+"-";
					}
				}
				schoolRecord2022.setPlanSubmitAdmission(planSubmitAdmission);
			}else{
				schoolRecord2022.setAvgGrade("-");
				schoolRecord2022.setMinGrade("-");
				schoolRecord2022.setAvgGradeSeq("-");
				schoolRecord2022.setMinGradeSeq("-");
				schoolRecord2022.setPlan("-");
				schoolRecord2022.setSubmit("-");
				schoolRecord2022.setPlanSubmitAdmission("-");
			}



			School schoolRecord2021=new School();
			schoolRecord2021.setProvinceName(provinceName);
			schoolRecord2021.setSname(school.getSname());
			schoolRecord2021.setScode(school.getScode());
			schoolRecord2021.setZyz(zyz);
			schoolRecord2021.setZxkm(zyzPlan.getKm2());
			schoolRecord2021.setYear(yearNew2);
			schoolRecord2021.setSranking(school.getSranking());

			if("物理".equals(memberQuery.getSxkm())) {
				schoolRecord2021.setGradeLine(new Integer(gradeLineLg2021).toString());
			}else{
				schoolRecord2021.setGradeLine(new Integer(gradeLineWs2021).toString());
			}

			if(provinceName.equals("广西")) {
				if(memberGradeList!=null&&memberGradeList.size()>0){
					for(int k=0;k<memberGradeList.size();k++){
						BuzMemberGrade memberGrade=memberGradeList.get(k);
						if(memberGrade.getYear().intValue()==yearNew2){
							if(memberGrade.getPmGradeGx()!=null) {
								schoolRecord2021.setSeqGrade(memberGrade.getPmGradeGx().toString());
							}else{
								schoolRecord2021.setSeqGrade("-");
							}
						}
					}
				}

				if(memberQuery.getGradePmGx()!=null) {
					schoolRecord2021.setSeq(memberQuery.getGradePmGx().toString());
				}else{
					schoolRecord2021.setSeq("-");
				}
			}else {

				if(memberGradeList!=null&&memberGradeList.size()>0){
					for(int k=0;k<memberGradeList.size();k++){
						BuzMemberGrade memberGrade=memberGradeList.get(k);
						if(memberGrade.getYear().intValue()==yearNew2){
							if(memberGrade.getPmGradeGx()!=null) {
								schoolRecord2021.setSeqGrade(memberGrade.getPmGrade().toString());
							}else{
								schoolRecord2021.setSeqGrade("-");
							}
						}
					}
				}

				if(memberQuery.getGradePm()!=null) {
					schoolRecord2021.setSeq(memberQuery.getGradePm().toString());
				}else{
					schoolRecord2021.setSeq("-");
				}
			}


			/**
			 * 计算当年最低分，最低分排名，平均分，平均分对应的排名
			 */
			SchoolPlan zyz2021=null;
			for(int k=0;k<zyzList.size();k++) {
				SchoolPlan school3 = zyzList.get(k);
				if (school3.getYear().intValue() == yearNew2 &&
						school3.getSchoolCode().equals(school.getScode()) &&
						school3.getZyz().equals(school.getZyz())) {
					zyz2021=school3;
					break;

				}
			}
			if(zyz2021!=null){
				if(zyz2021.getZyzAvgGrade()!=null){
					schoolRecord2021.setAvgGrade(zyz2021.getZyzAvgGrade().toString());
				}else{
					schoolRecord2021.setAvgGrade("-");
				}
				if(zyz2021.getZyzLowGrade()!=null){
					schoolRecord2021.setMinGrade(zyz2021.getZyzLowGrade().toString());
				}else{
					schoolRecord2021.setMinGrade("-");
				}
				if(zyz2021.getZyzLowPm()!=null){
					schoolRecord2021.setMinGradeSeq(zyz2021.getZyzLowPm().toString());
				}else{
					schoolRecord2021.setMinGradeSeq("-");
				}
				if(zyz2021.getZyzAvgPm()!=null){
					schoolRecord2021.setAvgGradeSeq(zyz2021.getZyzAvgPm().toString());
				}else{
					schoolRecord2021.setAvgGradeSeq("-");
				}
				String planSubmitAdmission="";
				if(zyz2021.getZyzPlan()!=null){
					schoolRecord2021.setPlan(zyz2021.getZyzPlan().toString());
					planSubmitAdmission=zyz2021.getZyzPlan().toString();
				}else{
					schoolRecord2021.setPlan("-");
				}
				if(zyz2021.getZyzAdmin()!=null){
					schoolRecord2021.setSubmit(zyz2021.getZyzAdmin().toString());
					planSubmitAdmission=planSubmitAdmission+"-"+zyz2021.getZyzAdmin().toString();
				}else{
					schoolRecord2021.setSubmit("-");
					if(zyz2021.getZyzPlan()!=null){
						planSubmitAdmission=planSubmitAdmission+"-";
					}
				}
				schoolRecord2021.setPlanSubmitAdmission(planSubmitAdmission);
			}else{
				schoolRecord2021.setAvgGrade("-");
				schoolRecord2021.setMinGrade("-");
				schoolRecord2021.setAvgGradeSeq("-");
				schoolRecord2021.setMinGradeSeq("-");
				schoolRecord2021.setPlan("-");
				schoolRecord2021.setSubmit("-");
				schoolRecord2021.setPlanSubmitAdmission("-");
			}


			School schoolRecord2020=new School();
			schoolRecord2020.setProvinceName(provinceName);
			schoolRecord2020.setSname(school.getSname());
			schoolRecord2020.setScode(school.getScode());
			schoolRecord2020.setZyz(zyz);
			schoolRecord2020.setZxkm(zyzPlan.getKm2());
			schoolRecord2020.setYear(yearNew3);
			schoolRecord2020.setSranking(school.getSranking());

			if("物理".equals(memberQuery.getSxkm())) {
				schoolRecord2020.setGradeLine(new Integer(gradeLineLg2020).toString());
			}else{
				schoolRecord2020.setGradeLine(new Integer(gradeLineWs2020).toString());
			}


			if(provinceName.equals("广西")) {

				if(memberGradeList!=null&&memberGradeList.size()>0){
					for(int k=0;k<memberGradeList.size();k++){
						BuzMemberGrade memberGrade=memberGradeList.get(k);
						if(memberGrade.getYear().intValue()==yearNew3){
							if(memberGrade.getPmGradeGx()!=null) {
								schoolRecord2020.setSeqGrade(memberGrade.getPmGradeGx().toString());
							}else{
								schoolRecord2020.setSeqGrade("-");
							}
						}
					}
				}

				if(memberQuery.getGradePmGx()!=null) {
					schoolRecord2020.setSeq(memberQuery.getGradePmGx().toString());
				}else{
					schoolRecord2020.setSeq("-");
				}
			}else {

				if(memberGradeList!=null&&memberGradeList.size()>0){
					for(int k=0;k<memberGradeList.size();k++){
						BuzMemberGrade memberGrade=memberGradeList.get(k);
						if(memberGrade.getYear().intValue()==yearNew3){
							if(memberGrade.getPmGradeGx()!=null) {
								schoolRecord2020.setSeqGrade(memberGrade.getPmGrade().toString());
							}else{
								schoolRecord2020.setSeqGrade("-");
							}
						}
					}
				}

				if(memberQuery.getGradePm()!=null) {
					schoolRecord2020.setSeq(memberQuery.getGradePm().toString());
				}else{
					schoolRecord2020.setSeq("-");
				}

			}

			/**
			 * 计算当年最低分，最低分排名，平均分，平均分对应的排名
			 */
			SchoolPlan zyz2020=null;
			for(int k=0;k<zyzList.size();k++) {
				SchoolPlan school3 = zyzList.get(k);
				if (school3.getYear().intValue() == yearNew3 &&
						school3.getSchoolCode().equals(school.getScode()) &&
						school3.getZyz().equals(school.getZyz())) {
					zyz2020=school3;
					break;

				}
			}
			if(zyz2020!=null){
				if(zyz2020.getZyzAvgGrade()!=null){
					schoolRecord2020.setAvgGrade(zyz2020.getZyzAvgGrade().toString());
				}else{
					schoolRecord2020.setAvgGrade("-");
				}
				if(zyz2020.getZyzLowGrade()!=null){
					schoolRecord2020.setMinGrade(zyz2020.getZyzLowGrade().toString());
				}else{
					schoolRecord2020.setMinGrade("-");
				}
				if(zyz2020.getZyzLowPm()!=null){
					schoolRecord2020.setMinGradeSeq(zyz2020.getZyzLowPm().toString());
				}else{
					schoolRecord2020.setMinGradeSeq("-");
				}
				if(zyz2020.getZyzAvgPm()!=null){
					schoolRecord2020.setAvgGradeSeq(zyz2020.getZyzAvgPm().toString());
				}else{
					schoolRecord2020.setAvgGradeSeq("-");
				}
				String planSubmitAdmission="";
				if(zyz2020.getZyzPlan()!=null){
					schoolRecord2020.setPlan(zyz2020.getZyzPlan().toString());
					planSubmitAdmission=zyz2020.getZyzPlan().toString();
				}else{
					schoolRecord2020.setPlan("-");
				}
				if(zyz2020.getZyzAdmin()!=null){
					schoolRecord2020.setSubmit(zyz2020.getZyzAdmin().toString());
					planSubmitAdmission=planSubmitAdmission+"-"+zyz2020.getZyzAdmin().toString();
				}else{
					schoolRecord2020.setSubmit("-");
					if(zyz2020.getZyzPlan()!=null){
						planSubmitAdmission=planSubmitAdmission+"-";
					}
				}
				schoolRecord2020.setPlanSubmitAdmission(planSubmitAdmission);
			}else{
				schoolRecord2020.setAvgGrade("-");
				schoolRecord2020.setMinGrade("-");
				schoolRecord2020.setAvgGradeSeq("-");
				schoolRecord2020.setMinGradeSeq("-");
				schoolRecord2020.setPlan("-");
				schoolRecord2020.setSubmit("-");
				schoolRecord2020.setPlanSubmitAdmission("-");
			}

			/**
			 * 专业组投档概率
			 * (考生成绩-录取最低分)/2+50
			 * double finalRate = (memberGrade - grade) / 2 + 50;
			 */
			SchoolPlan lowGradePlan2024=null;
			for(int s=0;s<plans2024List.size();s++) {
				SchoolPlan plan2024 = plans2024List.get(s);



				//学校和专业组相等
				//System.out.println("------------plan2024.getSchoolCode()--------"+plan2024.getSchoolCode()+"------schoolRecord2022.getScode()-----------"+schoolRecord2022.getScode()+"-------plan2024.getZyz()---"+plan2024.getZyz()+"-----schoolRecord2022.getZyz()---"+schoolRecord2022.getZyz()+"--");
				if (plan2024.getSchoolCode().equals(schoolRecord2022.getScode())
						&& plan2024.getZyz().equals(schoolRecord2022.getZyz())) {
					lowGradePlan2024=plan2024;
					break;
				}
			}
			if(provinceName.equals("广西")) {
				int memberGrade=memberQuery.getGxgrade();
				if(lowGradePlan2024!=null){
					int grade=lowGradePlan2024.getGrade();
					//double finalRate = (memberGrade - grade) / 2 + 50;


					float cha= (float)(memberGrade - grade) / 2;
					if(cha>0) cha=cha+1;
					if(cha<0) cha=cha-1;
					double finalRate = cha + 50;

					if(finalRate>=100) finalRate=99.99;
					if(finalRate<1) finalRate=1;

					if(schoolRecord2022.getMinGrade()!=null&&!schoolRecord2022.getMinGrade().equals("-")
							&&schoolRecord2022.getAvgGrade()!=null&&!schoolRecord2022.getAvgGrade().equals("-")){
						schoolRecord2020.setSubmitRate(df.format(finalRate));
						schoolRecord2021.setSubmitRate(df.format(finalRate));
						schoolRecord2022.setSubmitRate(df.format(finalRate));
					}else{
						schoolRecord2020.setSubmitRate("-");
						schoolRecord2021.setSubmitRate("-");
						schoolRecord2022.setSubmitRate("-");
					}

				}else{
					schoolRecord2020.setSubmitRate("-");
					schoolRecord2021.setSubmitRate("-");
					schoolRecord2022.setSubmitRate("-");
				}
			}else{
				int memberGrade=memberQuery.getQggrade();

				if(lowGradePlan2024!=null){
					int grade=lowGradePlan2024.getGrade();
					//double finalRate = (memberGrade - grade) / 2 + 50;

					float cha= (float)(memberGrade - grade) / 2;
					if(cha>0) cha=cha+1;
					if(cha<0) cha=cha-1;
					double finalRate = cha + 50;

					if(finalRate>=100) finalRate=99.99;
					if(finalRate<1) finalRate=1;

					if(schoolRecord2022.getMinGrade()!=null&&!schoolRecord2022.getMinGrade().equals("-")
							&&schoolRecord2022.getAvgGrade()!=null&&!schoolRecord2022.getAvgGrade().equals("-")){
						schoolRecord2020.setSubmitRate(df.format(finalRate));
						schoolRecord2021.setSubmitRate(df.format(finalRate));
						schoolRecord2022.setSubmitRate(df.format(finalRate));
					}else{
						schoolRecord2020.setSubmitRate("-");
						schoolRecord2021.setSubmitRate("-");
						schoolRecord2022.setSubmitRate("-");
					}
				}else{
					schoolRecord2020.setSubmitRate("-");
					schoolRecord2021.setSubmitRate("-");
					schoolRecord2022.setSubmitRate("-");
				}
			}

			returnList.add(schoolRecord2022);
			returnList.add(schoolRecord2021);
			returnList.add(schoolRecord2020);

			map.put("returnList", returnList);

			//该专业组下各专业录取概率
			List<SchoolMajorYearAdmission> zyList =new ArrayList();

			for(int i=0;i<distinctMajorList.size();i++) {
				SchoolPlan major =distinctMajorList.get(i);
				String majorPm="-";


				int zyavgGrade2022=0;
				int zyminGrade2022=0;
				int zyavgGrade2021=0;
				int zyminGrade2021=0;
				int zyavgGrade2020=0;
				int zyminGrade2020=0;

				//考生近3年的广西排位
				int gxj2022=0;
				int gxj2021=0;
				int gxj2020=0;
				//考生近3年全国排位分
				int qgj2022=0;
				int qgj2021=0;
				int qgj2020=0;


				boolean year1Flag=false;
				boolean year2Flag=false;
				boolean year3Flag=false;

				SchoolMajorYearAdmission schoolMajorYearAdmission2022 =null;
				SchoolMajorYearAdmission schoolMajorYearAdmission2021 =null;
				SchoolMajorYearAdmission schoolMajorYearAdmission2020 =null;

				for (int k = 0; k < majorList.size(); k++) {
					SchoolPlan schoolPlan = majorList.get(k);
					if(major.getMajorCode().equals(schoolPlan.getMajorCode())) {
						if (schoolPlan.getYear().intValue() == yearNew1) {
							year1Flag=true;

							schoolMajorYearAdmission2022 = new SchoolMajorYearAdmission();
							schoolMajorYearAdmission2022.setYear(yearNew1);
							schoolMajorYearAdmission2022.setMajorCode(schoolPlan.getMajorCode());
							schoolMajorYearAdmission2022.setMajorSeq(major.getMajorSeq());
							schoolMajorYearAdmission2022.setMajor(schoolPlan.getMajorName());
							schoolMajorYearAdmission2022.setThisYearMajorPlan(major.getMajorPlan());
							if(major.getMajorPlan()!=null){
								schoolMajorYearAdmission2022.setThisYearMajorPlanStr(major.getMajorPlan().toString());
							}else{
								schoolMajorYearAdmission2022.setThisYearMajorPlanStr("-");
							}
							schoolMajorYearAdmission2022.setsCode(schoolPlan.getSchoolCode());
							schoolMajorYearAdmission2022.setZyz(schoolPlan.getZyz());
							schoolMajorYearAdmission2022.setMajorPm(major.getMajorPm());
							//System.out.println(schoolPlan.getMajorCode()+"------------22-----"+schoolPlan.getMajorPm());

							if(major.getMajorPm()!=null&&!major.getMajorPm().equals("")){
								majorPm=major.getMajorPm();
							}


							//设置分数线
							if ("物理".equals(memberQuery.getSxkm())) {
								schoolMajorYearAdmission2022.setGradeLine(new Integer(gradeLineLg2022).toString());
							}
							if ("历史".equals(memberQuery.getSxkm())) {
								schoolMajorYearAdmission2022.setGradeLine(new Integer(gradeLineWs2022).toString());
							}

							/**
							 * 计算当年的排名和对应的分数
							 */
							if (provinceName.equals("广西")) {

								if (memberGradeList != null && memberGradeList.size() > 0) {
									for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
										BuzMemberGrade memberGrade = memberGradeList.get(k1);
										if (memberGrade.getYear().intValue() == yearNew1) {
											if (memberGrade.getPmGradeGx() != null) {
												schoolMajorYearAdmission2022.setSeqGrade(memberGrade.getPmGradeGx().toString());
												gxj2022=memberGrade.getPmGradeGx();
											} else {
												schoolMajorYearAdmission2022.setSeqGrade("-");
											}
										}
									}
								}

								if (memberQuery.getGradePmGx() != null) {
									schoolMajorYearAdmission2022.setSeq(memberQuery.getGradePmGx().toString());
								} else {
									schoolMajorYearAdmission2022.setSeq("-");
								}
							} else {

								if (memberGradeList != null && memberGradeList.size() > 0) {
									for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
										BuzMemberGrade memberGrade = memberGradeList.get(k1);
										if (memberGrade.getYear().intValue() == yearNew1) {
											if (memberGrade.getPmGradeGx() != null) {
												schoolMajorYearAdmission2022.setSeqGrade(memberGrade.getPmGrade().toString());
												qgj2022=memberGrade.getPmGrade();
											} else {
												schoolMajorYearAdmission2022.setSeqGrade("-");
											}
										}
									}
								}

								if (memberQuery.getGradePm() != null) {
									schoolMajorYearAdmission2022.setSeq(memberQuery.getGradePm().toString());
								} else {
									schoolMajorYearAdmission2022.setSeq("-");
								}

							}

							/**
							 * 计算平均分、平均分排名、最低分、最低分排名、招生计划数和录取数
							 */

							if (schoolPlan.getMajorAvgGrade() != null) {
								schoolMajorYearAdmission2022.setAvgGradeStr(schoolPlan.getMajorAvgGrade().toString());
								zyavgGrade2022=schoolPlan.getMajorAvgGrade();
							} else {
								schoolMajorYearAdmission2022.setAvgGradeStr("-");
							}
							if (schoolPlan.getMajorLowGrade() != null) {
								schoolMajorYearAdmission2022.setMinGradeStr(schoolPlan.getMajorLowGrade().toString());
								zyminGrade2022=schoolPlan.getMajorLowGrade();
							} else {
								schoolMajorYearAdmission2022.setMinGradeStr("-");
							}
							if (schoolPlan.getMajorLowPm() != null) {
								schoolMajorYearAdmission2022.setMinGradeSeq(schoolPlan.getMajorLowPm().toString());
							} else {
								schoolMajorYearAdmission2022.setMinGradeSeq("-");
							}
							if (schoolPlan.getMajorAvgPm() != null) {
								schoolMajorYearAdmission2022.setAvgGradeSeq(schoolPlan.getMajorAvgPm().toString());
							} else {
								schoolMajorYearAdmission2022.setAvgGradeSeq("-");
							}
							String planSubmitAdmission = "";
							if (schoolPlan.getMajorPlan() != null) {
								schoolMajorYearAdmission2022.setMajorPlan(schoolPlan.getMajorPlan());
								schoolMajorYearAdmission2022.setMajorPlanStr(schoolPlan.getMajorPlan().toString());
								planSubmitAdmission = schoolPlan.getMajorPlan().toString();
							} else {
								schoolMajorYearAdmission2022.setMajorPlan(null);
							}
							if (schoolPlan.getMajorAdmin() != null) {
								schoolMajorYearAdmission2022.setSubmit(schoolPlan.getMajorAdmin());
								schoolMajorYearAdmission2022.setAdmission(schoolPlan.getMajorAdmin());
								planSubmitAdmission = planSubmitAdmission + "-" + schoolPlan.getMajorAdmin().toString();
							} else {
								schoolMajorYearAdmission2022.setSubmit(null);
								schoolMajorYearAdmission2022.setAdmission(null);
								if (schoolPlan.getMajorPlan() != null) {
									planSubmitAdmission = planSubmitAdmission + "-";
								}
							}
							schoolMajorYearAdmission2022.setPlanSubmitAdmission(planSubmitAdmission);

						}


						if (schoolPlan.getYear().intValue() == yearNew2) {

							year2Flag=true;

							schoolMajorYearAdmission2021 = new SchoolMajorYearAdmission();
							schoolMajorYearAdmission2021.setYear(yearNew2);
							schoolMajorYearAdmission2021.setMajorCode(schoolPlan.getMajorCode());
							schoolMajorYearAdmission2021.setMajorSeq(major.getMajorSeq());
							schoolMajorYearAdmission2021.setMajor(schoolPlan.getMajorName());
							schoolMajorYearAdmission2021.setThisYearMajorPlan(major.getMajorPlan());
							if(major.getMajorPlan()!=null){
								schoolMajorYearAdmission2021.setThisYearMajorPlanStr(major.getMajorPlan().toString());
							}else{
								schoolMajorYearAdmission2021.setThisYearMajorPlanStr("-");
							}
							schoolMajorYearAdmission2021.setsCode(schoolPlan.getSchoolCode());
							schoolMajorYearAdmission2021.setZyz(schoolPlan.getZyz());
							schoolMajorYearAdmission2021.setMajorPm(major.getMajorPm());
							//System.out.println(schoolPlan.getMajorCode()+"------------21-----"+schoolPlan.getMajorPm());
							if(major.getMajorPm()!=null&&!major.getMajorPm().equals("")){
								majorPm=major.getMajorPm();
							}


							//设置分数线
							if ("物理".equals(memberQuery.getSxkm())) {
								schoolMajorYearAdmission2021.setGradeLine(new Integer(gradeLineLg2021).toString());
							}
							if ("历史".equals(memberQuery.getSxkm())) {
								schoolMajorYearAdmission2021.setGradeLine(new Integer(gradeLineWs2021).toString());
							}

							/**
							 * 计算当年的排名和对应的分数
							 */
							if (provinceName.equals("广西")) {

								if (memberGradeList != null && memberGradeList.size() > 0) {
									for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
										BuzMemberGrade memberGrade = memberGradeList.get(k1);
										if (memberGrade.getYear().intValue() == yearNew2) {
											if (memberGrade.getPmGradeGx() != null) {
												schoolMajorYearAdmission2021.setSeqGrade(memberGrade.getPmGradeGx().toString());
												gxj2021=memberGrade.getPmGradeGx();
											} else {
												schoolMajorYearAdmission2021.setSeqGrade("-");
											}
										}
									}
								}

								if (memberQuery.getGradePmGx() != null) {
									schoolMajorYearAdmission2021.setSeq(memberQuery.getGradePmGx().toString());
								} else {
									schoolMajorYearAdmission2021.setSeq("-");
								}
							} else {

								if (memberGradeList != null && memberGradeList.size() > 0) {
									for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
										BuzMemberGrade memberGrade = memberGradeList.get(k1);
										if (memberGrade.getYear().intValue() == yearNew2) {
											if (memberGrade.getPmGradeGx() != null) {
												schoolMajorYearAdmission2021.setSeqGrade(memberGrade.getPmGrade().toString());
												qgj2021=memberGrade.getPmGrade();
											} else {
												schoolMajorYearAdmission2021.setSeqGrade("-");
											}
										}
									}
								}

								if (memberQuery.getGradePm() != null) {
									schoolMajorYearAdmission2021.setSeq(memberQuery.getGradePm().toString());
								} else {
									schoolMajorYearAdmission2021.setSeq("-");
								}

							}


							if (schoolPlan.getMajorAvgGrade() != null) {
								schoolMajorYearAdmission2021.setAvgGradeStr(schoolPlan.getMajorAvgGrade().toString());
								zyavgGrade2021=schoolPlan.getMajorAvgGrade();
							} else {
								schoolMajorYearAdmission2021.setAvgGradeStr("-");
							}
							if (schoolPlan.getMajorLowGrade() != null) {
								schoolMajorYearAdmission2021.setMinGradeStr(schoolPlan.getMajorLowGrade().toString());
								zyminGrade2021=schoolPlan.getMajorLowGrade();
							} else {
								schoolMajorYearAdmission2021.setMinGradeStr("-");
							}
							if (schoolPlan.getMajorLowPm() != null) {
								schoolMajorYearAdmission2021.setMinGradeSeq(schoolPlan.getMajorLowPm().toString());
							} else {
								schoolMajorYearAdmission2021.setMinGradeSeq("-");
							}
							if (schoolPlan.getMajorAvgPm() != null) {
								schoolMajorYearAdmission2021.setAvgGradeSeq(schoolPlan.getMajorAvgPm().toString());
							} else {
								schoolMajorYearAdmission2021.setAvgGradeSeq("-");
							}
							String planSubmitAdmission = "";
							if (schoolPlan.getMajorPlan() != null) {
								schoolMajorYearAdmission2021.setMajorPlan(schoolPlan.getMajorPlan());
								schoolMajorYearAdmission2021.setMajorPlanStr(schoolPlan.getMajorPlan().toString());
								planSubmitAdmission = schoolPlan.getMajorPlan().toString();
							} else {
								schoolMajorYearAdmission2021.setMajorPlan(null);
							}
							if (schoolPlan.getMajorAdmin() != null) {
								schoolMajorYearAdmission2021.setSubmit(schoolPlan.getMajorAdmin());
								schoolMajorYearAdmission2021.setAdmission(schoolPlan.getMajorAdmin());
								planSubmitAdmission = planSubmitAdmission + "-" + schoolPlan.getMajorAdmin().toString();
							} else {
								schoolMajorYearAdmission2021.setSubmit(null);
								schoolMajorYearAdmission2021.setAdmission(null);
								if (schoolPlan.getMajorPlan() != null) {
									planSubmitAdmission = planSubmitAdmission + "-";
								}
							}
							schoolMajorYearAdmission2021.setPlanSubmitAdmission(planSubmitAdmission);


						}


						if (schoolPlan.getYear().intValue() == yearNew3) {

							year3Flag=true;

							schoolMajorYearAdmission2020 = new SchoolMajorYearAdmission();
							schoolMajorYearAdmission2020.setYear(yearNew3);
							schoolMajorYearAdmission2020.setMajorCode(schoolPlan.getMajorCode());
							schoolMajorYearAdmission2020.setMajorSeq(major.getMajorSeq());
							schoolMajorYearAdmission2020.setMajor(schoolPlan.getMajorName());
							schoolMajorYearAdmission2020.setThisYearMajorPlan(major.getMajorPlan());
							if(major.getMajorPlan()!=null){
								schoolMajorYearAdmission2020.setThisYearMajorPlanStr(major.getMajorPlan().toString());
							}else{
								schoolMajorYearAdmission2020.setThisYearMajorPlanStr("-");
							}
							schoolMajorYearAdmission2020.setsCode(schoolPlan.getSchoolCode());
							schoolMajorYearAdmission2020.setZyz(schoolPlan.getZyz());
							schoolMajorYearAdmission2020.setMajorPm(major.getMajorPm());
							//System.out.println(schoolPlan.getMajorCode()+"------------20-----"+schoolPlan.getMajorPm());
							if(major.getMajorPm()!=null&&!major.getMajorPm().equals("")){
								majorPm=major.getMajorPm();
							}


							//设置分数线
							if ("物理".equals(memberQuery.getSxkm())) {
								schoolMajorYearAdmission2020.setGradeLine(new Integer(gradeLineLg2020).toString());
							}
							if ("历史".equals(memberQuery.getSxkm())) {
								schoolMajorYearAdmission2020.setGradeLine(new Integer(gradeLineWs2020).toString());
							}

							/**
							 * 计算当年的排名和对应的分数
							 */
							if (provinceName.equals("广西")) {

								if (memberGradeList != null && memberGradeList.size() > 0) {
									for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
										BuzMemberGrade memberGrade = memberGradeList.get(k1);
										if (memberGrade.getYear().intValue() == yearNew3) {
											if (memberGrade.getPmGradeGx() != null) {
												schoolMajorYearAdmission2020.setSeqGrade(memberGrade.getPmGradeGx().toString());
												gxj2020=memberGrade.getPmGradeGx();
											} else {
												schoolMajorYearAdmission2020.setSeqGrade("-");
											}
										}
									}
								}

								if (memberQuery.getGradePmGx() != null) {
									schoolMajorYearAdmission2020.setSeq(memberQuery.getGradePmGx().toString());
								} else {
									schoolMajorYearAdmission2020.setSeq("-");
								}
							} else {

								if (memberGradeList != null && memberGradeList.size() > 0) {
									for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
										BuzMemberGrade memberGrade = memberGradeList.get(k1);
										if (memberGrade.getYear().intValue() == yearNew3) {
											if (memberGrade.getPmGradeGx() != null) {
												schoolMajorYearAdmission2020.setSeqGrade(memberGrade.getPmGrade().toString());
												qgj2020=memberGrade.getPmGrade();
											} else {
												schoolMajorYearAdmission2020.setSeqGrade("-");
											}
										}
									}
								}

								if (memberQuery.getGradePm() != null) {
									schoolMajorYearAdmission2020.setSeq(memberQuery.getGradePm().toString());
								} else {
									schoolMajorYearAdmission2020.setSeq("-");
								}

							}


							if (schoolPlan.getMajorAvgGrade() != null) {
								schoolMajorYearAdmission2020.setAvgGradeStr(schoolPlan.getMajorAvgGrade().toString());
								zyavgGrade2020=schoolPlan.getMajorAvgGrade();
							} else {
								schoolMajorYearAdmission2020.setAvgGradeStr("-");
							}
							if (schoolPlan.getMajorLowGrade() != null) {
								schoolMajorYearAdmission2020.setMinGradeStr(schoolPlan.getMajorLowGrade().toString());
								zyminGrade2020=schoolPlan.getMajorLowGrade();
							} else {
								schoolMajorYearAdmission2020.setMinGradeStr("-");
							}
							if (schoolPlan.getMajorLowPm() != null) {
								schoolMajorYearAdmission2020.setMinGradeSeq(schoolPlan.getMajorLowPm().toString());
							} else {
								schoolMajorYearAdmission2020.setMinGradeSeq("-");
							}
							if (schoolPlan.getMajorAvgPm() != null) {
								schoolMajorYearAdmission2020.setAvgGradeSeq(schoolPlan.getMajorAvgPm().toString());
							} else {
								schoolMajorYearAdmission2020.setAvgGradeSeq("-");
							}
							String planSubmitAdmission = "";
							if (schoolPlan.getMajorPlan() != null) {
								schoolMajorYearAdmission2020.setMajorPlan(schoolPlan.getMajorPlan());
								schoolMajorYearAdmission2020.setMajorPlanStr(schoolPlan.getMajorPlan().toString());
								planSubmitAdmission = schoolPlan.getMajorPlan().toString();
							} else {
								schoolMajorYearAdmission2020.setMajorPlan(null);
							}
							if (schoolPlan.getMajorAdmin() != null) {
								schoolMajorYearAdmission2020.setSubmit(schoolPlan.getMajorAdmin());
								schoolMajorYearAdmission2020.setAdmission(schoolPlan.getMajorAdmin());
								planSubmitAdmission = planSubmitAdmission + "-" + schoolPlan.getMajorAdmin().toString();
							} else {
								schoolMajorYearAdmission2020.setSubmit(null);
								schoolMajorYearAdmission2020.setAdmission(null);
								if (schoolPlan.getMajorPlan() != null) {
									planSubmitAdmission = planSubmitAdmission + "-";
								}
							}
							schoolMajorYearAdmission2020.setPlanSubmitAdmission(planSubmitAdmission);


						}//3个年份判断结束

					}//专业明细与专业循环是同一个专业
				}//专业明细循环，下面要开始判断一共添加了几个专业

				if(!year1Flag) {//第一个年份是空，需要添加空记录
					year1Flag=true;

					schoolMajorYearAdmission2022 = new SchoolMajorYearAdmission();
					schoolMajorYearAdmission2022.setYear(yearNew1);
					schoolMajorYearAdmission2022.setMajorCode(major.getMajorCode());
					schoolMajorYearAdmission2022.setMajorSeq(major.getMajorSeq());
					schoolMajorYearAdmission2022.setMajor(major.getMajorName());
					schoolMajorYearAdmission2022.setThisYearMajorPlan(major.getMajorPlan());
					if(major.getMajorPlan()!=null){
						schoolMajorYearAdmission2022.setThisYearMajorPlanStr(major.getMajorPlan().toString());
					}else{
						schoolMajorYearAdmission2022.setThisYearMajorPlanStr("-");
					}
					schoolMajorYearAdmission2022.setsCode(major.getSchoolCode());
					schoolMajorYearAdmission2022.setZyz(major.getZyz());
					schoolMajorYearAdmission2022.setMajorPm(major.getMajorPm());


					//设置分数线
					if ("物理".equals(memberQuery.getSxkm())) {
						schoolMajorYearAdmission2022.setGradeLine(new Integer(gradeLineLg2022).toString());
					}
					if ("历史".equals(memberQuery.getSxkm())) {
						schoolMajorYearAdmission2022.setGradeLine(new Integer(gradeLineWs2022).toString());
					}

					/**
					 * 计算当年的排名和对应的分数
					 */
					if (provinceName.equals("广西")) {

						if (memberGradeList != null && memberGradeList.size() > 0) {
							for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
								BuzMemberGrade memberGrade = memberGradeList.get(k1);
								if (memberGrade.getYear().intValue() == yearNew1) {
									if (memberGrade.getPmGradeGx() != null) {
										schoolMajorYearAdmission2022.setSeqGrade(memberGrade.getPmGradeGx().toString());
									} else {
										schoolMajorYearAdmission2022.setSeqGrade("-");
									}
								}
							}
						}

						if (memberQuery.getGradePmGx() != null) {
							schoolMajorYearAdmission2022.setSeq(memberQuery.getGradePmGx().toString());
						} else {
							schoolMajorYearAdmission2022.setSeq("-");
						}
					} else {

						if (memberGradeList != null && memberGradeList.size() > 0) {
							for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
								BuzMemberGrade memberGrade = memberGradeList.get(k1);
								if (memberGrade.getYear().intValue() == yearNew1) {
									if (memberGrade.getPmGradeGx() != null) {
										schoolMajorYearAdmission2022.setSeqGrade(memberGrade.getPmGrade().toString());
									} else {
										schoolMajorYearAdmission2022.setSeqGrade("-");
									}
								}
							}
						}

						if (memberQuery.getGradePm() != null) {
							schoolMajorYearAdmission2022.setSeq(memberQuery.getGradePm().toString());
						} else {
							schoolMajorYearAdmission2022.setSeq("-");
						}

					}

					schoolMajorYearAdmission2022.setAvgGradeStr("-");
					schoolMajorYearAdmission2022.setAvgGradeSeq("-");
					schoolMajorYearAdmission2022.setMinGradeStr("-");
					schoolMajorYearAdmission2022.setMinGradeSeq("-");
					schoolMajorYearAdmission2022.setMajorPlan(null);
					schoolMajorYearAdmission2022.setSubmit(null);
					schoolMajorYearAdmission2022.setPlanSubmitAdmission("-");

				}//补全第一个年份

				if(!year2Flag) {//第一个年份是空，需要添加空记录
					year2Flag=true;

					schoolMajorYearAdmission2021 = new SchoolMajorYearAdmission();
					schoolMajorYearAdmission2021.setYear(yearNew2);
					schoolMajorYearAdmission2021.setMajorCode(major.getMajorCode());
					schoolMajorYearAdmission2021.setMajorSeq(major.getMajorSeq());
					schoolMajorYearAdmission2021.setMajor(major.getMajorName());
					schoolMajorYearAdmission2021.setThisYearMajorPlan(major.getMajorPlan());
					if(major.getMajorPlan()!=null){
						schoolMajorYearAdmission2021.setThisYearMajorPlanStr(major.getMajorPlan().toString());
					}else{
						schoolMajorYearAdmission2021.setThisYearMajorPlanStr("-");
					}
					schoolMajorYearAdmission2021.setsCode(major.getSchoolCode());
					schoolMajorYearAdmission2021.setZyz(major.getZyz());
					schoolMajorYearAdmission2021.setMajorPm(major.getMajorPm());


					//设置分数线
					if ("物理".equals(memberQuery.getSxkm())) {
						schoolMajorYearAdmission2021.setGradeLine(new Integer(gradeLineLg2021).toString());
					}
					if ("历史".equals(memberQuery.getSxkm())) {
						schoolMajorYearAdmission2021.setGradeLine(new Integer(gradeLineWs2021).toString());
					}

					/**
					 * 计算当年的排名和对应的分数
					 */
					if (provinceName.equals("广西")) {

						if (memberGradeList != null && memberGradeList.size() > 0) {
							for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
								BuzMemberGrade memberGrade = memberGradeList.get(k1);
								if (memberGrade.getYear().intValue() == yearNew2) {
									if (memberGrade.getPmGradeGx() != null) {
										schoolMajorYearAdmission2021.setSeqGrade(memberGrade.getPmGradeGx().toString());
									} else {
										schoolMajorYearAdmission2021.setSeqGrade("-");
									}
								}
							}
						}

						if (memberQuery.getGradePmGx() != null) {
							schoolMajorYearAdmission2021.setSeq(memberQuery.getGradePmGx().toString());
						} else {
							schoolMajorYearAdmission2021.setSeq("-");
						}
					} else {

						if (memberGradeList != null && memberGradeList.size() > 0) {
							for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
								BuzMemberGrade memberGrade = memberGradeList.get(k1);
								if (memberGrade.getYear().intValue() == yearNew2) {
									if (memberGrade.getPmGradeGx() != null) {
										schoolMajorYearAdmission2021.setSeqGrade(memberGrade.getPmGrade().toString());
									} else {
										schoolMajorYearAdmission2021.setSeqGrade("-");
									}
								}
							}
						}

						if (memberQuery.getGradePm() != null) {
							schoolMajorYearAdmission2021.setSeq(memberQuery.getGradePm().toString());
						} else {
							schoolMajorYearAdmission2021.setSeq("-");
						}

					}

					schoolMajorYearAdmission2021.setAvgGradeStr("-");
					schoolMajorYearAdmission2021.setAvgGradeSeq("-");
					schoolMajorYearAdmission2021.setMinGradeStr("-");
					schoolMajorYearAdmission2021.setMinGradeSeq("-");
					schoolMajorYearAdmission2021.setMajorPlan(null);
					schoolMajorYearAdmission2021.setSubmit(null);
					schoolMajorYearAdmission2021.setPlanSubmitAdmission("-");

				}//补全第二个年份

				if(!year3Flag) {//第一个年份是空，需要添加空记录
					year3Flag=true;

					schoolMajorYearAdmission2020 = new SchoolMajorYearAdmission();
					schoolMajorYearAdmission2020.setYear(yearNew3);
					schoolMajorYearAdmission2020.setMajorCode(major.getMajorCode());
					schoolMajorYearAdmission2020.setMajorSeq(major.getMajorSeq());
					schoolMajorYearAdmission2020.setMajor(major.getMajorName());
					schoolMajorYearAdmission2020.setThisYearMajorPlan(major.getMajorPlan());
					if(major.getMajorPlan()!=null){
						schoolMajorYearAdmission2020.setThisYearMajorPlanStr(major.getMajorPlan().toString());
					}else{
						schoolMajorYearAdmission2020.setThisYearMajorPlanStr("-");
					}
					schoolMajorYearAdmission2020.setsCode(major.getSchoolCode());
					schoolMajorYearAdmission2020.setZyz(major.getZyz());
					schoolMajorYearAdmission2020.setMajorPm(major.getMajorPm());


					//设置分数线
					if ("物理".equals(memberQuery.getSxkm())) {
						schoolMajorYearAdmission2020.setGradeLine(new Integer(gradeLineLg2020).toString());
					}
					if ("历史".equals(memberQuery.getSxkm())) {
						schoolMajorYearAdmission2020.setGradeLine(new Integer(gradeLineWs2020).toString());
					}

					/**
					 * 计算当年的排名和对应的分数
					 */
					if (provinceName.equals("广西")) {

						if (memberGradeList != null && memberGradeList.size() > 0) {
							for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
								BuzMemberGrade memberGrade = memberGradeList.get(k1);
								if (memberGrade.getYear().intValue() == yearNew3) {
									if (memberGrade.getPmGradeGx() != null) {
										schoolMajorYearAdmission2020.setSeqGrade(memberGrade.getPmGradeGx().toString());
									} else {
										schoolMajorYearAdmission2020.setSeqGrade("-");
									}
								}
							}
						}

						if (memberQuery.getGradePmGx() != null) {
							schoolMajorYearAdmission2020.setSeq(memberQuery.getGradePmGx().toString());
						} else {
							schoolMajorYearAdmission2020.setSeq("-");
						}
					} else {

						if (memberGradeList != null && memberGradeList.size() > 0) {
							for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
								BuzMemberGrade memberGrade = memberGradeList.get(k1);
								if (memberGrade.getYear().intValue() == yearNew3) {
									if (memberGrade.getPmGradeGx() != null) {
										schoolMajorYearAdmission2020.setSeqGrade(memberGrade.getPmGrade().toString());
									} else {
										schoolMajorYearAdmission2020.setSeqGrade("-");
									}
								}
							}
						}

						if (memberQuery.getGradePm() != null) {
							schoolMajorYearAdmission2020.setSeq(memberQuery.getGradePm().toString());
						} else {
							schoolMajorYearAdmission2020.setSeq("-");
						}

					}

					schoolMajorYearAdmission2020.setAvgGradeStr("-");
					schoolMajorYearAdmission2020.setAvgGradeSeq("-");
					schoolMajorYearAdmission2020.setMinGradeStr("-");
					schoolMajorYearAdmission2020.setMinGradeSeq("-");
					schoolMajorYearAdmission2020.setMajorPlan(null);
					schoolMajorYearAdmission2020.setSubmit(null);
					schoolMajorYearAdmission2020.setPlanSubmitAdmission("-");

				}//补全第三个年份


				/**
				 * 计算专业组投档概率
				 *
				 * 1、当年的排位分-该专业的平均分
				 */


				if(provinceName.equals("广西")) {
					int memberGxGrade=memberQuery.getGxgrade();
					int yearLowGrade=0;
					if(schoolMajorYearAdmission2022!=null&&schoolMajorYearAdmission2022.getMinGradeStr()!=null
							&&!schoolMajorYearAdmission2022.getMinGradeStr().equals("-")&&!schoolMajorYearAdmission2022.getMinGradeStr().equals("")){
						yearLowGrade=new Integer(schoolMajorYearAdmission2022.getMinGradeStr());
					}

					if(yearLowGrade==0){
						if(schoolMajorYearAdmission2021!=null&&schoolMajorYearAdmission2021.getMinGradeStr()!=null
								&&!schoolMajorYearAdmission2021.getMinGradeStr().equals("-")&&!schoolMajorYearAdmission2021.getMinGradeStr().equals("")){
							yearLowGrade = new Integer(schoolMajorYearAdmission2021.getMinGradeStr());
						}
					}
					if(yearLowGrade==0){
						if(schoolMajorYearAdmission2020!=null&&schoolMajorYearAdmission2020.getMinGradeStr()!=null
								&&!schoolMajorYearAdmission2020.getMinGradeStr().equals("-")&&!schoolMajorYearAdmission2020.getMinGradeStr().equals("")){
							yearLowGrade = new Integer(schoolMajorYearAdmission2020.getMinGradeStr());
						}
					}
					if(yearLowGrade==0){
						schoolMajorYearAdmission2020.setSubmitRate("-");
						schoolMajorYearAdmission2021.setSubmitRate("-");
						schoolMajorYearAdmission2022.setSubmitRate("-");
					}else {
						if (memberGxGrade == yearLowGrade) {
							schoolMajorYearAdmission2020.setSubmitRate("50");
							schoolMajorYearAdmission2021.setSubmitRate("50");
							schoolMajorYearAdmission2022.setSubmitRate("50");
						} else {
							float cha = (float) (memberGxGrade - yearLowGrade) / 2;
							if (cha < 0) {
								cha = cha - 1 + 50;
							} else {
								cha = cha + 1 + 50;
							}
							if (cha >= 100) cha = 99.99f;
							if (cha < 1) cha = 1;
							schoolMajorYearAdmission2020.setSubmitRate(df.format(cha));
							schoolMajorYearAdmission2021.setSubmitRate(df.format(cha));
							schoolMajorYearAdmission2022.setSubmitRate(df.format(cha));
						}
					}
				}else{
					int memberGxGrade=memberQuery.getQggrade();
					int yearLowGrade=0;
					if(schoolMajorYearAdmission2022!=null&&schoolMajorYearAdmission2022.getMinGradeStr()!=null
							&&!schoolMajorYearAdmission2022.getMinGradeStr().equals("-")&&!schoolMajorYearAdmission2022.getMinGradeStr().equals("")){
						yearLowGrade=new Integer(schoolMajorYearAdmission2022.getMinGradeStr());
					}

					if(yearLowGrade==0){
						if(schoolMajorYearAdmission2021!=null&&schoolMajorYearAdmission2021.getMinGradeStr()!=null
								&&!schoolMajorYearAdmission2021.getMinGradeStr().equals("-")&&!schoolMajorYearAdmission2021.getMinGradeStr().equals("")){
							yearLowGrade = new Integer(schoolMajorYearAdmission2021.getMinGradeStr());
						}
					}
					if(yearLowGrade==0){
						if(schoolMajorYearAdmission2020!=null&&schoolMajorYearAdmission2020.getMinGradeStr()!=null
								&&!schoolMajorYearAdmission2020.getMinGradeStr().equals("-")&&!schoolMajorYearAdmission2020.getMinGradeStr().equals("")){
							yearLowGrade = new Integer(schoolMajorYearAdmission2020.getMinGradeStr());
						}
					}
					if(yearLowGrade==0){
						schoolMajorYearAdmission2020.setSubmitRate("-");
						schoolMajorYearAdmission2021.setSubmitRate("-");
						schoolMajorYearAdmission2022.setSubmitRate("-");
					}else {
						if (memberGxGrade == yearLowGrade) {
							schoolMajorYearAdmission2020.setSubmitRate("50");
							schoolMajorYearAdmission2021.setSubmitRate("50");
							schoolMajorYearAdmission2022.setSubmitRate("50");
						} else {
							float cha = (float) (memberGxGrade - yearLowGrade) / 2;
							if (cha < 0) {
								cha = cha - 1 + 50;
							} else {
								cha = cha + 1 + 50;
							}
							if (cha >= 100) cha = 99.99f;
							if (cha < 1) cha = 1;
							schoolMajorYearAdmission2020.setSubmitRate(df.format(cha));
							schoolMajorYearAdmission2021.setSubmitRate(df.format(cha));
							schoolMajorYearAdmission2022.setSubmitRate(df.format(cha));
						}
					}
				}


				/*
				if(zyavgGrade2020>0&&zyavgGrade2021>0&&zyavgGrade2022>0) {//3年都有数据
					if(provinceName.equals("广西")) {
						if(gxj2020-zyavgGrade2020>0 &&gxj2021-zyavgGrade2021>0 &&gxj2022-zyavgGrade2022>0) {//3年的同位分都比录取平均分高
							double rate=((gxj2022-zyavgGrade2022)/2+80)*0.55+((gxj2021-zyavgGrade2021)/2+80)*0.3+((gxj2020-zyavgGrade2020)/2+80)*0.15;

							if(rate>=100) rate=99.99;
							if(rate<1) rate=1;
							schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
							schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
							schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
						}else {
							double rate=0;
							//2年高于
							int count=0;
							if(gxj2022-zyavgGrade2022>0) {
								count++;
							}
							if(gxj2021-zyavgGrade2021>0) {
								count++;
							}
							if(gxj2020-zyavgGrade2020>0) {
								count++;
							}
							if(count==2) {//有2年高于同位分的

								if(gxj2022-zyavgGrade2022>0) {
									rate=rate+((gxj2022-zyavgGrade2022)/2+70)*0.55;
								}else {
									rate=rate+((gxj2022-zyminGrade2022)/2+50)*0.55;
								}

								if(gxj2021-zyavgGrade2021>0) {
									rate=rate+((gxj2021-zyavgGrade2021)/2+70)*0.3;
								}else {
									rate=rate+((gxj2021-zyminGrade2021)/2+50)*0.3;
								}

								if(gxj2020-zyavgGrade2020>0) {
									rate=rate+((gxj2020-zyavgGrade2020)/2+70)*0.15;
								}else {
									rate=rate+((gxj2020-zyminGrade2020)/2+50)*0.15;
								}
							}else if(count==1) {//有1年高于同位分的

								if(gxj2022-zyavgGrade2022>0) {
									rate=rate+((gxj2022-zyavgGrade2022)/2+60)*0.55;
								}else {
									rate=rate+((gxj2022-zyminGrade2022)/2+50)*0.55;
								}

								if(gxj2021-zyavgGrade2021>0) {
									rate=rate+((gxj2021-zyavgGrade2021)/2+60)*0.3;
								}else {
									rate=rate+((gxj2021-zyminGrade2021)/2+50)*0.3;
								}

								if(gxj2020-zyavgGrade2020>0) {
									rate=rate+((gxj2020-zyavgGrade2020)/2+60)*0.15;
								}else {
									rate=rate+((gxj2020-zyminGrade2020)/2+50)*0.15;
								}

							}else {//一个高于的都没有
								rate=((gxj2022-zyminGrade2022)/2+50)*0.55+((gxj2021-zyminGrade2021)/2+50)*0.3+((gxj2020-zyminGrade2020)/2+50)*0.15;
							}

							if(rate>=100) rate=99.99;
							if(rate<1) rate=1;
							schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
							schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
							schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
						}
					}else {//全国学校，用全国同位分
						if(qgj2020-zyavgGrade2020>0 &&qgj2021-zyavgGrade2021>0 &&qgj2022-zyavgGrade2022>0) {//3年的同位分都比录取平均分高
							double rate=((qgj2022-zyavgGrade2022)/2+80)*0.55+((qgj2021-zyavgGrade2021)/2+80)*0.3+((qgj2020-zyavgGrade2020)/2+80)*0.15;

							if(rate>=100) rate=99.99;
							if(rate<1) rate=1;
							schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
							schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
							schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
						}else {
							double rate=0;
							//2年高于
							int count=0;
							if(qgj2022-zyavgGrade2022>0) {
								count++;
							}
							if(qgj2021-zyavgGrade2021>0) {
								count++;
							}
							if(qgj2020-zyavgGrade2020>0) {
								count++;
							}
							if(count==2) {//有2年高于同位分的

								if(qgj2022-zyavgGrade2022>0) {
									rate=rate+((qgj2022-zyavgGrade2022)/2+70)*0.55;
								}else {
									rate=rate+((qgj2022-zyminGrade2022)/2+50)*0.55;
								}

								if(qgj2021-zyavgGrade2021>0) {
									rate=rate+((qgj2021-zyavgGrade2021)/2+70)*0.3;
								}else {
									rate=rate+((qgj2021-zyminGrade2021)/2+50)*0.3;
								}

								if(qgj2020-zyavgGrade2020>0) {
									rate=rate+((qgj2020-zyavgGrade2020)/2+70)*0.15;
								}else {
									rate=rate+((qgj2020-zyminGrade2020)/2+50)*0.15;
								}
							}else if(count==1) {//有1年高于同位分的

								if(qgj2022-zyavgGrade2022>0) {
									rate=rate+((qgj2022-zyavgGrade2022)/2+60)*0.55;
								}else {
									rate=rate+((qgj2022-zyminGrade2022)/2+50)*0.55;
								}

								if(qgj2021-zyavgGrade2021>0) {
									rate=rate+((qgj2021-zyavgGrade2021)/2+60)*0.3;
								}else {
									rate=rate+((qgj2021-zyminGrade2021)/2+50)*0.3;
								}

								if(qgj2020-zyavgGrade2020>0) {
									rate=rate+((qgj2020-zyavgGrade2020)/2+60)*0.15;
								}else {
									rate=rate+((qgj2020-zyminGrade2020)/2+50)*0.15;
								}

							}else {//一个高于的都没有
								rate=((qgj2022-zyminGrade2022)/2+50)*0.55+((qgj2021-zyminGrade2021)/2+50)*0.3+((qgj2020-zyminGrade2020)/2+50)*0.15;
							}


							if(rate>=100) rate=99.99;
							if(rate<1) rate=1;
							schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
							schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
							schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
						}
					}
				}else {//数据不满3年
					int years=0;
					if(zyavgGrade2020>0) years++;
					if(zyavgGrade2021>0) years++;
					if(zyavgGrade2022>0) years++;
					if(years==2) {
						double rate=0;
						if(provinceName.equals("广西")) {
							int heightYears=0;//这两年中，同位分大于平均分的年份数=2，则+70，如果年份数=1，则+60，都不大于平均分，则+50
							if(zyavgGrade2022>0&&gxj2022-zyavgGrade2022>0) heightYears++;
							if(zyavgGrade2021>0&&gxj2021-zyavgGrade2021>0) heightYears++;
							if(zyavgGrade2020>0&&gxj2020-zyavgGrade2020>0) heightYears++;

							if(zyavgGrade2022>0) {//2022年有数据
								if(heightYears==2) {
									double rate1=((gxj2022-zyavgGrade2022)/2+70)*0.60;
									rate=rate+rate1;

									if(zyavgGrade2021>0) {
										double rate2=((gxj2021-zyavgGrade2021)/2+70)*0.40;
										rate=rate+rate2;
									}else {
										double rate2=((gxj2020-zyavgGrade2020)/2+70)*0.40;
										rate=rate+rate2;
									}
								}else if(heightYears==1) {
									if(gxj2022-zyavgGrade2022>0) {
										double rate1=((gxj2022-zyavgGrade2022)/2+60)*0.60;
										rate=rate+rate1;
									}else {
										double rate1=((gxj2022-zyminGrade2022)/2+50)*0.60;
										rate=rate+rate1;
									}
									if(zyavgGrade2021>0) {
										if(gxj2021-zyavgGrade2021>0) {
											double rate1=((gxj2021-zyavgGrade2021)/2+60)*0.40;
											rate=rate+rate1;
										}else {
											double rate1=((gxj2021-zyminGrade2021)/2+60)*0.40;
											rate=rate+rate1;
										}
									}else {
										if(gxj2020-zyavgGrade2020>0) {
											double rate1=((gxj2020-zyavgGrade2020)/2+60)*0.40;
											rate=rate+rate1;
										}else {
											double rate1=((gxj2020-zyminGrade2020)/2+60)*0.40;
											rate=rate+rate1;
										}
									}
								}else {//都不高于平均分
									double rate1=((gxj2022-zyminGrade2022)/2+50)*0.60;
									rate=rate+rate1;
									if(zyavgGrade2021>0) {
										double rate2=((gxj2021-zyminGrade2021)/2+50)*0.60;
										rate=rate+rate2;
									}else {
										double rate2=((gxj2020-zyminGrade2020)/2+50)*0.40;
										rate=rate+rate2;
									}
								}
							}else {//2022年没数据，只有2021和2020年数据
								if(heightYears==2) {
									double rate1=((gxj2021-zyavgGrade2021)/2+70)*0.60+((gxj2020-zyavgGrade2020)/2+70)*0.40;
									rate=rate+rate1;
								}else if(heightYears==1) {
									if(gxj2021-zyavgGrade2021>0) {
										double rate1=((gxj2021-zyavgGrade2021)/2+60)*0.60;
										rate=rate+rate1;
									}else {
										double rate1=((gxj2021-zyminGrade2021)/2+50)*0.60;
										rate=rate+rate1;
									}
									if(gxj2020-zyavgGrade2020>0) {
										double rate1=((gxj2020-zyavgGrade2020)/2+60)*0.40;
										rate=rate+rate1;
									}else {
										double rate1=((gxj2020-zyminGrade2020)/2+50)*0.40;
										rate=rate+rate1;
									}
								}else {
									double rate1=((gxj2021-zyminGrade2021)/2+50)*0.60;
									rate=rate+rate1;

									double rate2=((gxj2020-zyminGrade2020)/2+50)*0.40;
									rate=rate+rate2;
								}
							}
						}else {//只有2年数据，全国的
							int heightYears=0;//这两年中，同位分大于平均分的年份数=2，则+70，如果年份数=1，则+60，都不大于平均分，则+50
							if(zyavgGrade2022>0&&qgj2022-zyavgGrade2022>0) heightYears++;
							if(zyavgGrade2021>0&&qgj2021-zyavgGrade2021>0) heightYears++;
							if(zyavgGrade2020>0&&qgj2020-zyavgGrade2020>0) heightYears++;

							if(zyavgGrade2022>0) {//2022年有数据
								if(heightYears==2) {
									double rate1=((qgj2022-zyavgGrade2022)/2+70)*0.60;
									rate=rate+rate1;

									if(zyavgGrade2021>0) {
										double rate2=((qgj2021-zyavgGrade2021)/2+70)*0.40;
										rate=rate+rate2;
									}else {
										double rate2=((qgj2020-zyavgGrade2020)/2+70)*0.40;
										rate=rate+rate2;
									}
								}else if(heightYears==1) {
									if(qgj2022-zyavgGrade2022>0) {
										double rate1=((qgj2022-zyavgGrade2022)/2+60)*0.60;
										rate=rate+rate1;
									}else {
										double rate1=((qgj2022-zyminGrade2022)/2+50)*0.60;
										rate=rate+rate1;
									}
									if(zyavgGrade2021>0) {
										if(qgj2021-zyavgGrade2021>0) {
											double rate1=((qgj2021-zyavgGrade2021)/2+60)*0.40;
											rate=rate+rate1;
										}else {
											double rate1=((qgj2021-zyminGrade2021)/2+60)*0.40;
											rate=rate+rate1;
										}
									}else {
										if(qgj2020-zyavgGrade2020>0) {
											double rate1=((qgj2020-zyavgGrade2020)/2+60)*0.40;
											rate=rate+rate1;
										}else {
											double rate1=((qgj2020-zyminGrade2020)/2+60)*0.40;
											rate=rate+rate1;
										}
									}
								}else {//都不高于平均分
									double rate1=((qgj2022-zyminGrade2022)/2+50)*0.60;
									rate=rate+rate1;
									if(zyavgGrade2021>0) {
										double rate2=((qgj2021-zyminGrade2021)/2+50)*0.60;
										rate=rate+rate2;
									}else {
										double rate2=((qgj2020-zyminGrade2020)/2+50)*0.40;
										rate=rate+rate2;
									}
								}
							}else {//2022年没数据，只有2021和2020年数据
								if(heightYears==2) {
									double rate1=((qgj2021-zyavgGrade2021)/2+70)*0.60+((qgj2020-zyavgGrade2020)/2+70)*0.40;
									rate=rate+rate1;
								}else if(heightYears==1) {
									if(qgj2021-zyavgGrade2021>0) {
										double rate1=((qgj2021-zyavgGrade2021)/2+60)*0.60;
										rate=rate+rate1;
									}else {
										double rate1=((qgj2021-zyminGrade2021)/2+50)*0.60;
										rate=rate+rate1;
									}
									if(qgj2020-zyavgGrade2020>0) {
										double rate1=((qgj2020-zyavgGrade2020)/2+60)*0.40;
										rate=rate+rate1;
									}else {
										double rate1=((qgj2020-zyminGrade2020)/2+50)*0.40;
										rate=rate+rate1;
									}
								}else {
									double rate1=((qgj2021-zyminGrade2021)/2+50)*0.60;
									rate=rate+rate1;

									double rate2=((qgj2020-zyminGrade2020)/2+50)*0.40;
									rate=rate+rate2;
								}
							}

						}

						if(rate>=100) rate=99.99;
						if(rate<1) rate=1;
						schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
						schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
						schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
					}else {//只有一年数据
						if(provinceName.equals("广西")) {

							if(zyavgGrade2022>0) {
								double rate=((gxj2022-zyminGrade2022)/2)+50;

								if(rate>=100) rate=99.99;
								if(rate<1) rate=1;
								schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
								schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
								schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
							}
							if(zyavgGrade2021>0) {
								double rate=((gxj2021-zyminGrade2021)/2)+50;

								if(rate>=100) rate=99.99;
								if(rate<1) rate=1;
								schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
								schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
								schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
							}
							if(zyavgGrade2020>0) {
								double rate=((gxj2020-zyminGrade2020)/2)+50;

								if(rate>=100) rate=99.99;
								if(rate<1) rate=1;
								schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
								schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
								schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
							}
						}else {//全国只有一年数据
							if(zyavgGrade2022>0) {
								double rate=((qgj2022-zyminGrade2022)/2)+50;

								if(rate>=100) rate=99.99;
								if(rate<1) rate=1;
								schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
								schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
								schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
							}
							if(zyavgGrade2021>0) {
								double rate=((qgj2021-zyminGrade2021)/2)+50;

								if(rate>=100) rate=99.99;
								if(rate<1) rate=1;
								schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
								schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
								schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
							}
							if(zyavgGrade2020>0) {
								double rate=((qgj2020-zyminGrade2020)/2)+50;

								if(rate>=100) rate=99.99;
								if(rate<1) rate=1;
								schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
								schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
								schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
							}
						}
					}
				}

				 */

/*
					专业的录取概率:(今年的院校专业组投档概率X80%+现在系统显示的录取概率Ⅹ20%）
					 */
				/*
				for(int s=0;s<plans2024List.size();s++){
					SchoolPlan plan2024= plans2024List.get(s);
					//学校和专业组相等
					if(plan2024.getSchoolCode().equals(schoolMajorYearAdmission2022.getsCode())
							&&plan2024.getZyz().equals(schoolMajorYearAdmission2022.getZyz())){
						//最低录取分数线
						int grade=plan2024.getGrade();
						int memberGrade=memberQuery.getGrade();
						if(schoolMajorYearAdmission2022.getSubmitRate()!=null) {
							double rate=new Double(schoolMajorYearAdmission2022.getSubmitRate());
							//((考生成绩-录取最低分)/2+50)*0.8+schoolRecord2022.getSubmitRate()*0.2
							//double finalRate = ((memberGrade - grade) / 2 + 50) * 0.8 + rate * 0.2;

							float cha= (float)(memberGrade - grade) / 2;
							if(cha>0) cha=cha+1;
							if(cha<0) cha=cha-1;
							double finalRate = cha + 50;

							if(finalRate>=100) finalRate=99.99;
							if(finalRate<1) finalRate=1;
							schoolMajorYearAdmission2022.setSubmitRate(df.format(finalRate));
							schoolMajorYearAdmission2022.setSubmitRate(df.format(finalRate));
							schoolMajorYearAdmission2022.setSubmitRate(df.format(finalRate));
						}

					}
				}

				 */

				if(schoolMajorYearAdmission2022.getSubmitRate()==null) {
					schoolMajorYearAdmission2022.setSubmitRate("-");
				}

				if(schoolMajorYearAdmission2022.getPlanSubmitAdmission()==null) {
					schoolMajorYearAdmission2022.setPlanSubmitAdmission("-");
				}

				schoolMajorYearAdmission2022.setMajorPm(majorPm);
				schoolMajorYearAdmission2021.setMajorPm(majorPm);
				schoolMajorYearAdmission2020.setMajorPm(majorPm);

				if(schoolMajorYearAdmission2022.getAvgGradeSeq()==null||schoolMajorYearAdmission2022.getAvgGradeSeq().equals("99999999")) {
					schoolMajorYearAdmission2022.setAvgGradeSeq("-");
				}

				if(schoolMajorYearAdmission2022.getMinGradeSeq()==null||schoolMajorYearAdmission2022.getMinGradeSeq().equals("99999999")) {
					schoolMajorYearAdmission2022.setMinGradeSeq("-");
				}

				if(schoolMajorYearAdmission2021.getSubmitRate()==null) {
					schoolMajorYearAdmission2021.setSubmitRate("-");

				}
				if(schoolMajorYearAdmission2021.getPlanSubmitAdmission()==null) {
					schoolMajorYearAdmission2021.setPlanSubmitAdmission("-");
				}


				if(schoolMajorYearAdmission2021.getAvgGradeSeq()==null||schoolMajorYearAdmission2021.getAvgGradeSeq().equals("99999999")) {
					schoolMajorYearAdmission2021.setAvgGradeSeq("-");
				}

				if(schoolMajorYearAdmission2021.getMinGradeSeq()==null||schoolMajorYearAdmission2021.getMinGradeSeq().equals("99999999")) {
					schoolMajorYearAdmission2021.setMinGradeSeq("-");
				}

				if(schoolMajorYearAdmission2020.getSubmitRate()==null) {
					schoolMajorYearAdmission2020.setSubmitRate("-");
				}
				if(schoolMajorYearAdmission2020.getPlanSubmitAdmission()==null) {
					schoolMajorYearAdmission2020.setPlanSubmitAdmission("-");
				}

				if(schoolMajorYearAdmission2022.getMajorPlan()==null) {
					schoolMajorYearAdmission2022.setMajorPlan(9999);
                    schoolMajorYearAdmission2022.setMajorPlanStr("-");
				}else{
					schoolMajorYearAdmission2022.setMajorPlanStr(schoolMajorYearAdmission2022.getMajorPlan().toString());
				}

				if(schoolMajorYearAdmission2021.getMajorPlan()==null) {
					schoolMajorYearAdmission2021.setMajorPlan(9999);
					schoolMajorYearAdmission2021.setMajorPlanStr("-");
				}else{
					schoolMajorYearAdmission2021.setMajorPlanStr(schoolMajorYearAdmission2021.getMajorPlan().toString());
				}

				if(schoolMajorYearAdmission2020.getMajorPlan()==null) {
					schoolMajorYearAdmission2020.setMajorPlan(9999);
					schoolMajorYearAdmission2020.setMajorPlanStr("-");
				}else{
					schoolMajorYearAdmission2021.setMajorPlanStr(schoolMajorYearAdmission2020.getMajorPlan().toString());
				}

				if(schoolMajorYearAdmission2020.getAvgGradeSeq()==null||schoolMajorYearAdmission2020.getAvgGradeSeq().equals("99999999")) {
					schoolMajorYearAdmission2020.setAvgGradeSeq("-");
				}

				if(schoolMajorYearAdmission2020.getMinGradeSeq()==null||schoolMajorYearAdmission2020.getMinGradeSeq().equals("99999999")) {
					schoolMajorYearAdmission2020.setMinGradeSeq("-");
				}

				zyList.add(schoolMajorYearAdmission2022);
				zyList.add(schoolMajorYearAdmission2021);
				zyList.add(schoolMajorYearAdmission2020);

				map.put("zyList", zyList);


			}//专业循环
        	
        	
        }else {
        	return AjaxResult.error("找不到学校信息");
        }

		map.put("member", memberQuery);
    	
    	return AjaxResult.success(map);
    }
    
    
    /************
     * 
     * @param schoolCode
     * @param zyz
     * @param userId
     * @return
     * 返回内容为：
     * 1个school对象
     * 1个专业组数组
     * 第一个专业组的投档概率（3条记录）
     * 第一个专业组下个专业的投档概率（每个专业3条记录）
     */
    @ApiOperation("专科根据专业组显示综合分析详情")
    @GetMapping("/showByZyz_zk")
    public AjaxResult showByZyz_zk(String schoolCode,String zyz,String userId)
    {
    	
    	if(userId==null||userId.equals("")) {
    		return AjaxResult.error("请先登录");
    	}
    	
    	if(isSpecialChar(userId.toString())||sqlValidate(userId.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	BuzMember memberQuery=buzMemberService.selectBuzMemberById(userId);

    	if(memberQuery!=null&&memberQuery.getPhone()!=null) {
    		
    	}else {
    		
    		return AjaxResult.error("会员信息不存在，请先注册成为会员");
    	}
    	
    	if(memberQuery.getSfvip().intValue()==0) {
        	return AjaxResult.error("系统已更新，非会员不能查询");
        }
    	
    	if(schoolCode==null||schoolCode.trim().equals("")) {
    		return AjaxResult.error("请选择学校");
    	}
    	
    	if(zyz==null||zyz.trim().equals("")) {
    		return AjaxResult.error("请选择专业组");
    	}
    	
    	if(isSpecialChar(schoolCode.toString())||sqlValidate(schoolCode.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	if(isSpecialChar(zyz.toString())||sqlValidate(zyz.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	Map map=new HashMap();
    	
    	
    	School schoolQuery=new School();
        
        
        if("物理".equals(memberQuery.getSxkm())) {
        	schoolQuery.setMajorType("理工类");
    	}
    	if("历史".equals(memberQuery.getSxkm())) {
    		schoolQuery.setMajorType("文史类");
    	}
    	
    	//如果会员不是少数民族，则不能查询民族班
    	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
    		schoolQuery.setSsmzFlag(0);
    	}
    	
    	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
    		schoolQuery.setGjzxFlag(0);
    	}
    	
    	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
    		schoolQuery.setGxzxFlag(0);
    	}
    	
    	//考生的再选科目
    	schoolQuery.setZxkm(memberQuery.getZxkm());   
        
    	schoolQuery.setScode(schoolCode);
                
        int pageRow=0;
        
        schoolQuery.setPageNum(pageRow);
        
        
        
        
        List<School> list = schoolService.selectSchoolList4Page(schoolQuery);
        if(list!=null&&list.size()>0) {
        	School school=list.get(0);
        	
        	
        	boolean qgjfFlag=true;//是否认可全国加分
        	if(school.getRemark()!=null) {
        		if(school.getRemark().indexOf("不认可加分")>-1) {//该学校不认可加分，则全国分只取高考分
        			qgjfFlag=false;
        		}
        	}
        	
        	String provinceName=school.getProvinceName();
        	
        	
        	schoolCode="'"+schoolCode+"'";
        	
        	//查询专业组
        	SchoolPlan schoolPlanQuery=new SchoolPlan();
        	schoolPlanQuery.setYear(thisYear);
        	schoolPlanQuery.setSchoolCode(schoolCode);
        	if("物理".equals(memberQuery.getSxkm())) {
        		schoolPlanQuery.setMajorType("理工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		schoolPlanQuery.setMajorType("文史类");
        	}
        	
        	
        	//如果会员不是少数民族，则不能查询民族班
        	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
        		schoolPlanQuery.setSsmzFlag(0);
        	}
        	
        	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
        		schoolPlanQuery.setGjzxFlag(0);
        	}
        	
        	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
        		schoolPlanQuery.setGxzxFlag(0);
        	}
        	
        	//考生的再选科目
        	schoolPlanQuery.setZxkm(memberQuery.getZxkm());
        	
        	schoolPlanQuery.setZyz(zyz);
        	List<SchoolPlan> zyzList =schoolPlanService.selectSchoolZyzPlanList(schoolPlanQuery);
        	
        	
        	
        	
        	List<SchoolPlan> plans2023List =schoolPlanService.selectSchoolZyz2023PlanList(schoolPlanQuery);
        	
        	
        	//查询各个专业组近3年的平均分、最低分（当前计算，先以2020,2021,2022这3年的录取数据为模拟数据）
        	SchoolMajorYearAdmission schoolMajorYearAdmission=new SchoolMajorYearAdmission();
        	schoolMajorYearAdmission.setYear(thisYear);
        	schoolMajorYearAdmission.setsCode(schoolCode);
        	if("物理".equals(memberQuery.getSxkm())) {
        		schoolMajorYearAdmission.setMajorType("理工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		schoolMajorYearAdmission.setMajorType("文史类");
        	}
        	schoolMajorYearAdmission.setZyz(zyz);
        	
        	//如果会员不是少数民族，则不能查询民族班
        	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
        		schoolMajorYearAdmission.setSsmzFlag(0);
        	}
        	
        	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
        		schoolMajorYearAdmission.setGjzxFlag(0);
        	}
        	
        	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
        		schoolMajorYearAdmission.setGxzxFlag(0);
        	}
        	
        	//考生的再选科目
        	schoolMajorYearAdmission.setZxkm(memberQuery.getZxkm());
        	
        	List<SchoolMajorYearAdmission> zyzGradeList=schoolMajorYearAdmissionService.selectSchoolZyzYearAdmissionList(schoolMajorYearAdmission);
        	
        	//查询当年考生的排位(先用2023年的一分一档)，拿到2023年该分数的排位，取出2022、2021、2020年的同位分
        	int gxpw=99999999;
        	
        	//广西排位分
        	GkGradeDoc gkGradeDoc=new GkGradeDoc();
        	gkGradeDoc.setGrade(memberQuery.getGxgrade());
        	gkGradeDoc.setYear(gradeLineYear);
        	if("物理".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("史类");
        	}
        	List<GkGradeDoc> gradeList=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);
        	
        	for(int z=0;z<gradeList.size();z++) {
        		GkGradeDoc gradeDoc=gradeList.get(z);
        		if(gradeDoc.getUseIn().equals("广西")) {
        			gxpw=gradeDoc.getSeq();
        		}
        	}
        	
        	//查找近3年的广西同位分
        	gkGradeDoc=new GkGradeDoc();
        	if("物理".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("史类");
        	}
        	gkGradeDoc.setUseIn("广西");
        	gkGradeDoc.setSeq(gxpw);
        	List<GkGradeDoc> gxpwGradeList=gkGradeDocService.selectGkGradeDocListBySeq(gkGradeDoc);
        	List<GkGradeDoc> gxLastPwGradeList=gkGradeDocService.selectGkGradeDocLastRecordList(gkGradeDoc);
        	
        	
        	int qgpw=99999999;        	        	
        	int temp_qgjfpw=99999999;//全国加分的排位(认可加分)
        	int temp_qgpw=99999999;//全国加分的排位(不认可加分)
        	
        	
        	//全国认可加分排位分
        	gkGradeDoc=new GkGradeDoc();
        	gkGradeDoc.setGrade(memberQuery.getQggrade());
        	
        	gkGradeDoc.setYear(2024);
        	if("物理".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("史类");
        	}
        	List<GkGradeDoc> gradeList2=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);
        	
        	for(int z=0;z<gradeList2.size();z++) {
        		GkGradeDoc gradeDoc=gradeList2.get(z);
        		
        		if(gradeDoc.getUseIn().equals("全国")) {
        			temp_qgjfpw=gradeDoc.getSeq();//认可加分的排位分
        		}
        	}
        	
        	//全国不认可加分排位分
        	gkGradeDoc=new GkGradeDoc();
        	gkGradeDoc.setGrade(memberQuery.getGrade());
        	
        	gkGradeDoc.setYear(2024);
        	if("物理".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("史类");
        	}
        	List<GkGradeDoc> gradeList3=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);
        	
        	gkGradeDoc.setUseIn("全国");
        	List<GkGradeDoc> qgGradeList=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);
        	
        	for(int z=0;z<gradeList3.size();z++) {
        		GkGradeDoc gradeDoc=gradeList3.get(z);
        		
        		if(gradeDoc.getUseIn().equals("全国")) {
        			temp_qgpw=gradeDoc.getSeq();//认可加分的排位分
        		}
        	}
        	
        	
        	//查找进3年的全国同位分（认可加分的排位）
        	gkGradeDoc=new GkGradeDoc();
        	if("物理".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("史类");
        	}
        	gkGradeDoc.setUseIn("全国");
        	gkGradeDoc.setSeq(temp_qgjfpw);
        	List<GkGradeDoc> qgpwGradeList=gkGradeDocService.selectGkGradeDocListBySeq(gkGradeDoc);
        	
        	
        	//不认可加分的排位
        	gkGradeDoc.setSeq(temp_qgpw);
        	List<GkGradeDoc> qgpwNoAddGradeList=gkGradeDocService.selectGkGradeDocListBySeq(gkGradeDoc);
        	
        	
        	
        	
        	int gxj2022=0;
        	int gxj2021=0;
        	int gxj2020=0;
        	for(int i=0;i<gxpwGradeList.size();i++) {
        		GkGradeDoc gxGradeDoc=gxpwGradeList.get(i);
        		if(gxGradeDoc.getYear().intValue()==yearNew1) {
        			gxj2022=gxGradeDoc.getGrade();
        		}
        		if(gxGradeDoc.getYear().intValue()==yearNew2) {
        			gxj2021=gxGradeDoc.getGrade();
        		}
        		if(gxGradeDoc.getYear().intValue()==yearNew3) {
        			gxj2020=gxGradeDoc.getGrade();
        		}
        	}
        	if(gxj2022==0) {
        		for(int i=0;i<gxLastPwGradeList.size();i++) {
            		GkGradeDoc gxGradeDoc=gxLastPwGradeList.get(i);
            		if(gxGradeDoc.getYear().intValue()==yearNew1) {
            			gxj2022=gxGradeDoc.getGrade();
            		}
        		}
        	}
        	
        	if(gxj2021==0) {
        		for(int i=0;i<gxLastPwGradeList.size();i++) {
            		GkGradeDoc gxGradeDoc=gxLastPwGradeList.get(i);
            		if(gxGradeDoc.getYear().intValue()==yearNew2) {
            			gxj2021=gxGradeDoc.getGrade();
            		}
        		}
        	}
        	
        	if(gxj2020==0) {
        		for(int i=0;i<gxLastPwGradeList.size();i++) {
            		GkGradeDoc gxGradeDoc=gxLastPwGradeList.get(i);
            		if(gxGradeDoc.getYear().intValue()==yearNew3) {
            			gxj2020=gxGradeDoc.getGrade();
            		}
        		}
        	}
        	
        	
        	
        	
        	
        	int qgj2022=0;
        	int qgj2021=0;
        	int qgj2020=0;
        	
        	if(qgjfFlag) {//认可加分
        		qgpw=temp_qgjfpw;
        		for(int z=0;z<qgpwGradeList.size();z++) {
            		GkGradeDoc gxGradeDoc=qgpwGradeList.get(z);
            		if(gxGradeDoc.getYear().intValue()==yearNew1) {
            			qgj2022=gxGradeDoc.getGrade();
            		}
            		if(gxGradeDoc.getYear().intValue()==yearNew2) {
            			qgj2021=gxGradeDoc.getGrade();
            		}
            		if(gxGradeDoc.getYear().intValue()==yearNew3) {
            			qgj2020=gxGradeDoc.getGrade();
            		}
            	}
        	}else {//不认可加分
        		qgpw=temp_qgpw;
        		for(int z=0;z<qgpwNoAddGradeList.size();z++) {
            		GkGradeDoc gxGradeDoc=qgpwNoAddGradeList.get(z);
            		if(gxGradeDoc.getYear().intValue()==yearNew1) {
            			qgj2022=gxGradeDoc.getGrade();
            		}
            		if(gxGradeDoc.getYear().intValue()==yearNew2) {
            			qgj2021=gxGradeDoc.getGrade();
            		}
            		if(gxGradeDoc.getYear().intValue()==yearNew3) {
            			qgj2020=gxGradeDoc.getGrade();
            		}
            	}
        	}
        	
        	if(qgj2022==0) {
        		for(int z=0;z<qgGradeList.size();z++) {
            		GkGradeDoc gxGradeDoc=qgGradeList.get(z);
            		if(gxGradeDoc.getYear().intValue()==yearNew1) {
            			qgj2022=gxGradeDoc.getGrade();
            		}
        		}
        	}
        	
        	if(qgj2021==0) {
        		for(int z=0;z<qgGradeList.size();z++) {
            		GkGradeDoc gxGradeDoc=qgGradeList.get(z);
            		if(gxGradeDoc.getYear().intValue()==yearNew2) {
            			qgj2021=gxGradeDoc.getGrade();
            		}
        		}
        	}
        	
        	if(qgj2020==0) {
        		for(int z=0;z<qgGradeList.size();z++) {
            		GkGradeDoc gxGradeDoc=qgGradeList.get(z);
            		if(gxGradeDoc.getYear().intValue()==yearNew3) {
            			qgj2020=gxGradeDoc.getGrade();
            		}
        		}
        	}
        	
        	
        	
        	//查询历年一分一档，用于计算平均分排位和最低分排位
        	GkGradeDoc hisGkGradeDoc=new GkGradeDoc();
        	if("物理".equals(memberQuery.getSxkm())) {
        		hisGkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		hisGkGradeDoc.setGradeClass("史类");
        	}
        	
        	List<GkGradeDoc> hisPwGradeList=gkGradeDocService.selectGkGradeDocList(hisGkGradeDoc);
        	
        	
        	
        	//专业组投档概率
        	List<School> returnList =new ArrayList();
        	
        	
        	DecimalFormat df = new DecimalFormat("#.00");
        	//开始计算专业组投档率
        	if(zyzList!=null&&zyzList.size()>0) {
        		SchoolPlan zyzPlan=zyzList.get(0);//取出该学校第一个专业组
				
				
				int avgGrade2022=0;
				int minGrade2022=0;
				int avgGrade2021=0;
				int minGrade2021=0;
				int avgGrade2020=0;
				int minGrade2020=0;
				
				//历史招生数量，从指南取
				int plan2022=0;
				int submit2022=0;
				int adm2022=0;
				int plan2021=0;
				int submit2021=0;
				int adm2021=0;
				int plan2020=0;
				int submit2020=0;
				int adm2020=0;
				
				//当年招生数量，从招生计划取
				int plan2023=0;
				
				School schoolRecord2022=new School();
				schoolRecord2022.setProvinceName(provinceName);
				schoolRecord2022.setSname(school.getSname());
				schoolRecord2022.setScode(school.getScode());
				schoolRecord2022.setZyz(zyz);
				schoolRecord2022.setZxkm(zyzPlan.getKm2());
				schoolRecord2022.setYear(yearNew1);
				schoolRecord2022.setSranking(school.getSranking());
				
				if(provinceName.equals("广西")) {
					schoolRecord2022.setSeqGrade(new Integer(gxj2022).toString());
					schoolRecord2022.setSeq(new Integer(gxpw).toString());
				}else {
					schoolRecord2022.setSeqGrade(new Integer(qgj2022).toString());
					schoolRecord2022.setSeq(new Integer(qgpw).toString());
				}
				
				
				//设置分数线
				if("物理".equals(memberQuery.getSxkm())) {
					schoolRecord2022.setGradeLine(new Integer(gradeLineLg2022).toString());
				}
				if("历史".equals(memberQuery.getSxkm())) {
					schoolRecord2022.setGradeLine(new Integer(gradeLineWs2022).toString());
				}
				
				SchoolMajorYearAdmission admission2022=null;
				SchoolMajorYearAdmission admission2021=null;
				SchoolMajorYearAdmission admission2020=null;
				for(int j=0;j<zyzGradeList.size();j++) {
					SchoolMajorYearAdmission admission=zyzGradeList.get(j);
					String zyzAdmin=admission.getZyz();
					
					if(zyz.equals(zyzAdmin)&&admission.getsCode().equals(zyzPlan.getSchoolCode())) {//同一个学校的专业组        						
						if(admission.getYear()==yearNew1) {
							admission2022=admission;
						}
						if(admission.getYear()==yearNew2) {
							admission2021=admission;
						}
						if(admission.getYear()==yearNew3) {
							admission2020=admission;
						}
					}
				}
				if(admission2022!=null&&admission2022.getAvgGrade()!=null) {
					schoolRecord2022.setAvgGrade(admission2022.getAvgGrade().toString());
					schoolRecord2022.setMinGrade(admission2022.getLowGrade().toString());
					avgGrade2022=admission2022.getAvgGrade();
					minGrade2022=admission2022.getLowGrade();
					
					
					
					//计算平均分排位，最低分排位
					int avgGrade2022Seq=99999999;
					int lastSeq=1;
					for(int m=0;m<hisPwGradeList.size();m++) {
						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
						if(hisGradeDoc.getYear().intValue()==yearNew1) {
							
							
							int myGrade=hisGradeDoc.getGrade();
							
							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
								if(hisGradeDoc.getUseIn().equals("广西")) {
									int fencha=myGrade-avgGrade2022;
									if(fencha==0) {
										avgGrade2022Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										avgGrade2022Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
									
								}
							}else {
								if(hisGradeDoc.getUseIn().equals("全国")) {
									int fencha=myGrade-avgGrade2022;
									if(fencha==0) {
										avgGrade2022Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										avgGrade2022Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
								}
							}
							
						}
					}
					
					schoolRecord2022.setAvgGradeSeq(new Integer(avgGrade2022Seq).toString());
					
					
					int minGrade2022Seq=99999999;
					lastSeq=1;
					for(int m=0;m<hisPwGradeList.size();m++) {
						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
						if(hisGradeDoc.getYear().intValue()==yearNew1) {
							
							
							int myGrade=hisGradeDoc.getGrade();
							
							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
								if(hisGradeDoc.getUseIn().equals("广西")) {
									int fencha=myGrade-minGrade2022;
									if(fencha==0) {
										minGrade2022Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										minGrade2022Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
									
								}
							}else {
								if(hisGradeDoc.getUseIn().equals("全国")) {
									int fencha=myGrade-minGrade2022;
									if(fencha==0) {
										minGrade2022Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										minGrade2022Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
								}
							}
							
						}
					}
					
					schoolRecord2022.setMinGradeSeq(new Integer(minGrade2022Seq).toString());
					
					
					
					
				}else {
					schoolRecord2022.setAvgGrade("-");
					schoolRecord2022.setMinGrade("-");
					
					schoolRecord2022.setAvgGradeSeq("-");
					schoolRecord2022.setMinGradeSeq("-");
				}
				if(admission2022!=null) {
					plan2022=admission2022.getPlan();
					
					if(admission2022.getSubmit()!=null) {
						submit2022=admission2022.getSubmit();
					}
					adm2022=admission2022.getAdmission();
					schoolRecord2022.setPlanSubmitAdmission(plan2022+"-"+adm2022);
				}
				
				for(int j=0;j<plans2023List.size();j++) {
					SchoolPlan schoolPlan2023=plans2023List.get(j);
					if(zyz.equals(schoolPlan2023.getZyz())&&zyzPlan.getSchoolCode().equals(schoolPlan2023.getSchoolCode())) {//同一个学校的专业组        	
						plan2023=schoolPlan2023.getMajorPlan();
					}
				}
        		
        		
        		
				School schoolRecord2021=new School();
				schoolRecord2021.setProvinceName(provinceName);
				schoolRecord2021.setSname(school.getSname());
				schoolRecord2021.setScode(school.getScode());
				schoolRecord2021.setZyz(zyz);
				schoolRecord2021.setZxkm(zyzPlan.getKm2());
				schoolRecord2021.setYear(yearNew2);
				schoolRecord2021.setSranking(school.getSranking());
				
				if(provinceName.equals("广西")) {
					schoolRecord2021.setSeqGrade(new Integer(gxj2021).toString());
					schoolRecord2021.setSeq(new Integer(gxpw).toString());
				}else {
					schoolRecord2021.setSeqGrade(new Integer(qgj2021).toString());
					schoolRecord2021.setSeq(new Integer(qgpw).toString());
				}
				
				
				//设置分数线
				if("物理".equals(memberQuery.getSxkm())) {
					schoolRecord2021.setGradeLine(new Integer(gradeLineLg2021).toString());
				}
				if("历史".equals(memberQuery.getSxkm())) {
					schoolRecord2021.setGradeLine(new Integer(gradeLineWs2021).toString());
				}
				
				if(admission2021!=null&&admission2021.getAvgGrade()!=null) {
					schoolRecord2021.setAvgGrade(admission2021.getAvgGrade().toString());
					schoolRecord2021.setMinGrade(admission2021.getLowGrade().toString());
					avgGrade2021=admission2021.getAvgGrade();
					minGrade2021=admission2021.getLowGrade();
					
					
					//计算平均分排位，最低分排位
					int avgGrade2021Seq=99999999;
					int lastSeq=1;
					for(int m=0;m<hisPwGradeList.size();m++) {
						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
						if(hisGradeDoc.getYear().intValue()==yearNew2) {
							
							
							int myGrade=hisGradeDoc.getGrade();
							
							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
								if(hisGradeDoc.getUseIn().equals("广西")) {
									int fencha=myGrade-avgGrade2021;
									if(fencha==0) {
										avgGrade2021Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										avgGrade2021Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
									
								}
							}else {
								if(hisGradeDoc.getUseIn().equals("全国")) {
									int fencha=myGrade-avgGrade2021;
									if(fencha==0) {
										avgGrade2021Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										avgGrade2021Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
								}
							}
							
						}
					}
					
					schoolRecord2021.setAvgGradeSeq(new Integer(avgGrade2021Seq).toString());
					
					
					int minGrade2021Seq=99999999;
					lastSeq=1;
					for(int m=0;m<hisPwGradeList.size();m++) {
						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
						if(hisGradeDoc.getYear().intValue()==yearNew2) {
							
							
							int myGrade=hisGradeDoc.getGrade();
							
							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
								if(hisGradeDoc.getUseIn().equals("广西")) {
									int fencha=myGrade-minGrade2021;
									if(fencha==0) {
										minGrade2021Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										minGrade2021Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
									
								}
							}else {
								if(hisGradeDoc.getUseIn().equals("全国")) {
									int fencha=myGrade-minGrade2021;
									if(fencha==0) {
										minGrade2021Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										minGrade2021Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
								}
							}
							
						}
					}
					
					schoolRecord2021.setMinGradeSeq(new Integer(minGrade2021Seq).toString());
					
				}else {
					schoolRecord2021.setAvgGrade("-");
					schoolRecord2021.setMinGrade("-");
					
					schoolRecord2021.setMinGradeSeq("-");
					schoolRecord2021.setAvgGradeSeq("-");
				}
				
				if(admission2021!=null) {
				
					plan2021=admission2021.getPlan();
					if(admission2021.getSubmit()!=null) {
						submit2021=admission2021.getSubmit();
					}
					adm2021=admission2021.getAdmission();
					schoolRecord2021.setPlanSubmitAdmission(plan2021+"-"+adm2021);
				}
				
				
				School schoolRecord2020=new School();
				schoolRecord2020.setProvinceName(provinceName);
				schoolRecord2020.setSname(school.getSname());
				schoolRecord2020.setScode(school.getScode());
				schoolRecord2020.setZyz(zyz);
				schoolRecord2020.setZxkm(zyzPlan.getKm2());
				schoolRecord2020.setYear(yearNew3);
				schoolRecord2020.setSranking(school.getSranking());
				
				if(provinceName.equals("广西")) {
					schoolRecord2020.setSeqGrade(new Integer(gxj2020).toString());
					schoolRecord2020.setSeq(new Integer(gxpw).toString());
				}else {
					schoolRecord2020.setSeqGrade(new Integer(qgj2020).toString());
					schoolRecord2020.setSeq(new Integer(qgpw).toString());
				}
				
				
				//设置分数线
				if("物理".equals(memberQuery.getSxkm())) {
					schoolRecord2020.setGradeLine(new Integer(gradeLineLg2020).toString());
				}
				if("历史".equals(memberQuery.getSxkm())) {
					schoolRecord2020.setGradeLine(new Integer(gradeLineWs2020).toString());
				}
				
				if(admission2020!=null&&admission2020.getAvgGrade()!=null) {
					schoolRecord2020.setAvgGrade(admission2020.getAvgGrade().toString());
					schoolRecord2020.setMinGrade(admission2020.getLowGrade().toString());
					avgGrade2020=admission2020.getAvgGrade();
					minGrade2020=admission2020.getLowGrade();   
					
					
					//计算平均分排位，最低分排位
					int avgGrade2020Seq=99999999;
					int lastSeq=1;
					for(int m=0;m<hisPwGradeList.size();m++) {
						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
						if(hisGradeDoc.getYear().intValue()==yearNew3) {
							
							
							int myGrade=hisGradeDoc.getGrade();
							
							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
								if(hisGradeDoc.getUseIn().equals("广西")) {
									int fencha=myGrade-avgGrade2020;
									if(fencha==0) {
										avgGrade2020Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										avgGrade2020Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
									
								}
							}else {
								if(hisGradeDoc.getUseIn().equals("全国")) {
									int fencha=myGrade-avgGrade2020;
									if(fencha==0) {
										avgGrade2020Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										avgGrade2020Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
								}
							}
							
						}
					}
					
					schoolRecord2020.setAvgGradeSeq(new Integer(avgGrade2020Seq).toString());
					
					
					int minGrade2020Seq=99999999;
					lastSeq=1;
					for(int m=0;m<hisPwGradeList.size();m++) {
						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
						if(hisGradeDoc.getYear().intValue()==yearNew3) {
							
							
							int myGrade=hisGradeDoc.getGrade();
							
							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
								if(hisGradeDoc.getUseIn().equals("广西")) {
									int fencha=myGrade-minGrade2020;
									if(fencha==0) {
										minGrade2020Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										minGrade2020Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
									
								}
							}else {
								if(hisGradeDoc.getUseIn().equals("全国")) {
									int fencha=myGrade-minGrade2020;
									if(fencha==0) {
										minGrade2020Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										minGrade2020Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
								}
							}
							
						}
					}
					
					schoolRecord2020.setMinGradeSeq(new Integer(minGrade2020Seq).toString());
					
					
					
					
				}else {
					schoolRecord2020.setAvgGrade("-");
					schoolRecord2020.setMinGrade("-");
					schoolRecord2020.setMinGradeSeq("-");
					schoolRecord2020.setAvgGradeSeq("-");
				}
				if(admission2020!=null) {
					plan2020=admission2020.getPlan();
					if(admission2020.getSubmit()!=null) {
						submit2020=admission2020.getSubmit();
					}
					adm2020=admission2020.getAdmission();
					schoolRecord2020.setPlanSubmitAdmission(plan2020+"-"+adm2020);
				}
				
				//开始计算投档概率
				/****
				 * 专科的录取概率计算
				 * 2024年的分数为a，2023年的院校录取最低分为b,a-b除2—再加50%等于院校专业组投档概率。2024年的分数为c，2023年的专业录取最低分为d,c-d除2—再加50%等于院校专业录取概率。
				 */
				if(provinceName.equals("广西")) {//广西学校
					int userGrade=memberQuery.getGxgrade();
					double rate=(userGrade-minGrade2022)/2+50;
					if(rate>=100) rate=99.99;
					if(rate<1) rate=1;
					schoolRecord2020.setSubmitRate(df.format(rate));
					schoolRecord2021.setSubmitRate(df.format(rate));
					schoolRecord2022.setSubmitRate(df.format(rate));
				}else {//全国学校
					if(qgjfFlag) {//认可加分
						int userGrade=memberQuery.getQggrade();
    					double rate=(userGrade-minGrade2022)/2+50;
    					if(rate>=100) rate=99.99;
						if(rate<1) rate=1;
						schoolRecord2020.setSubmitRate(df.format(rate));
						schoolRecord2021.setSubmitRate(df.format(rate));
						schoolRecord2022.setSubmitRate(df.format(rate));
					}else {
						int userGrade=memberQuery.getGrade();
    					double rate=(userGrade-minGrade2022)/2+50;
    					if(rate>=100) rate=99.99;
						if(rate<1) rate=1;
						schoolRecord2020.setSubmitRate(df.format(rate));
						schoolRecord2021.setSubmitRate(df.format(rate));
						schoolRecord2022.setSubmitRate(df.format(rate));
					}
					
				}
				
				
				
				if(schoolRecord2022.getSubmitRate()==null) {
					schoolRecord2022.setSubmitRate("-");
				}
				if(schoolRecord2022.getPlanSubmitAdmission()==null) {
					schoolRecord2022.setPlanSubmitAdmission("-");
				}
				
				
				if(schoolRecord2022.getAvgGradeSeq()==null||schoolRecord2022.getAvgGradeSeq().equals("99999999")) {
					schoolRecord2022.setAvgGradeSeq("-");
				}
				
				if(schoolRecord2022.getMinGradeSeq()==null||schoolRecord2022.getMinGradeSeq().equals("99999999")) {
					schoolRecord2022.setMinGradeSeq("-");
				}
				
				if(schoolRecord2021.getSubmitRate()==null) {
					schoolRecord2021.setSubmitRate("-");
					
				}
				if(schoolRecord2021.getPlanSubmitAdmission()==null) {
					schoolRecord2021.setPlanSubmitAdmission("-");
				}
				
				
				if(schoolRecord2021.getAvgGradeSeq()==null||schoolRecord2021.getAvgGradeSeq().equals("99999999")) {
					schoolRecord2021.setAvgGradeSeq("-");
				}
				
				if(schoolRecord2021.getMinGradeSeq()==null||schoolRecord2021.getMinGradeSeq().equals("99999999")) {
					schoolRecord2021.setMinGradeSeq("-");
				}
				
				if(schoolRecord2020.getSubmitRate()==null) {
					schoolRecord2020.setSubmitRate("-");
				}
				if(schoolRecord2020.getPlanSubmitAdmission()==null) {
					schoolRecord2020.setPlanSubmitAdmission("-");
				}
				
				if(schoolRecord2020.getAvgGradeSeq()==null||schoolRecord2020.getAvgGradeSeq().equals("99999999")) {
					schoolRecord2020.setAvgGradeSeq("-");
				}
				
				if(schoolRecord2020.getMinGradeSeq()==null||schoolRecord2020.getMinGradeSeq().equals("99999999")) {
					schoolRecord2020.setMinGradeSeq("-");
				}
				
				returnList.add(schoolRecord2022);
				returnList.add(schoolRecord2021);
				returnList.add(schoolRecord2020);
        		
        		
				map.put("returnList", returnList);
        		
        		
				//该专业组下各专业录取概率
				List<SchoolMajorYearAdmission> zyList =new ArrayList();
        		//该专业今年的招生计划（从计划表中取）
				schoolPlanQuery.setZyz(zyz);
				
				if("物理".equals(memberQuery.getSxkm())) {
	        		schoolPlanQuery.setMajorType("理工类");
	        	}
	        	if("历史".equals(memberQuery.getSxkm())) {
	        		schoolPlanQuery.setMajorType("文史类");
	        	}
	        	
	        	//如果会员不是少数民族，则不能查询民族班
	        	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
	        		schoolPlanQuery.setSsmzFlag(0);
	        	}
	        	
	        	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
	        		schoolPlanQuery.setGjzxFlag(0);
	        	}
	        	
	        	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
	        		schoolPlanQuery.setGxzxFlag(0);
	        	}
	        	
	        	//考生的再选科目
	        	schoolPlanQuery.setZxkm(memberQuery.getZxkm());
				
				List<SchoolPlan> zyPlans2023List =schoolPlanService.selectSchoolZyPlan2023List(schoolPlanQuery);
				
				//该专业当年的招生计划和录取情况（从录取指南中取）
				//查询各个专业近3年的平均分、最低分（当前计算，先以2020,2021,2022这3年的录取数据为模拟数据）
	        	SchoolMajorYearAdmission schoolMajorYearAdmissionQuery=new SchoolMajorYearAdmission();
	        	schoolMajorYearAdmissionQuery.setYear(thisYear);
	        	schoolMajorYearAdmissionQuery.setsCode(schoolCode);
	        	if("物理".equals(memberQuery.getSxkm())) {
	        		schoolMajorYearAdmissionQuery.setMajorType("理工类");
	        	}
	        	if("历史".equals(memberQuery.getSxkm())) {
	        		schoolMajorYearAdmissionQuery.setMajorType("文史类");
	        	}
	        	schoolMajorYearAdmissionQuery.setZyz(zyz);
	        	
	        	
	        	//如果会员不是少数民族，则不能查询民族班
	        	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
	        		schoolMajorYearAdmission.setSsmzFlag(0);
	        	}
	        	
	        	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
	        		schoolMajorYearAdmission.setGjzxFlag(0);
	        	}
	        	
	        	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
	        		schoolMajorYearAdmission.setGxzxFlag(0);
	        	}
	        	
	        	//考生的再选科目
	        	schoolMajorYearAdmission.setZxkm(memberQuery.getZxkm());
	        	
	        	List<SchoolMajorYearAdmission> majorGradeList=schoolMajorYearAdmissionService.selectSchoolMajorZyYearAdmissionList(schoolMajorYearAdmissionQuery);
	        	
	        	//各专业录取明细
	        	List<SchoolMajorYearAdmission> majorGradeDetailList=schoolMajorYearAdmissionService.selectSchoolMajorZyYearAdmissionDetailList(schoolMajorYearAdmissionQuery);
	        	
	        	for(int k=0;k<zyPlans2023List.size();k++) {
	        		SchoolPlan schoolPlan=zyPlans2023List.get(k);
	        		
	        		int zyavgGrade2022=0;
    				int zyminGrade2022=0;
    				int zyavgGrade2021=0;
    				int zyminGrade2021=0;
    				int zyavgGrade2020=0;
    				int zyminGrade2020=0;
    				
    				//历史招生数量，从指南取
    				int zyplan2022=0;
    				int zysubmit2022=0;
    				int zyadm2022=0;
    				int zyplan2021=0;
    				int zysubmit2021=0;
    				int zyadm2021=0;
    				int zyplan2020=0;
    				int zysubmit2020=0;
    				int zyadm2020=0;
    				
    				//当年招生数量，从招生计划取
    				int zyplan2023=schoolPlan.getMajorPlan();
	        		
	        		SchoolMajorYearAdmission schoolMajorYearAdmission2022=new SchoolMajorYearAdmission();
	        		schoolMajorYearAdmission2022.setYear(yearNew1);
	        		schoolMajorYearAdmission2022.setMajorCode(schoolPlan.getMajorCode());
	        		schoolMajorYearAdmission2022.setMajorSeq(schoolPlan.getMajorSeq());
	        		schoolMajorYearAdmission2022.setMajor(schoolPlan.getMajorName());
	        		schoolMajorYearAdmission2022.setThisYearMajorPlan(schoolPlan.getMajorPlan());
	        		schoolMajorYearAdmission2022.setsCode(schoolPlan.getSchoolCode());
	        		schoolMajorYearAdmission2022.setZyz(schoolPlan.getZyz());
	        		
	        		
	        		if(provinceName.equals("广西")) {
	        			schoolMajorYearAdmission2022.setSeqGrade(new Integer(gxj2022).toString());
	        			schoolMajorYearAdmission2022.setSeq(new Integer(gxpw).toString());
    				}else {
    					schoolMajorYearAdmission2022.setSeqGrade(new Integer(qgj2022).toString());
    					schoolMajorYearAdmission2022.setSeq(new Integer(qgpw).toString());
    				}
    				
    				
    				//设置分数线
    				if("物理".equals(memberQuery.getSxkm())) {
    					schoolMajorYearAdmission2022.setGradeLine(new Integer(gradeLineLg2022).toString());
    				}
    				if("历史".equals(memberQuery.getSxkm())) {
    					schoolMajorYearAdmission2022.setGradeLine(new Integer(gradeLineWs2022).toString());
    				}
    				
    				SchoolMajorYearAdmission zyadmission2022=null;
    				SchoolMajorYearAdmission zyadmission2021=null;
    				SchoolMajorYearAdmission zyadmission2020=null;
    				for(int j=0;j<majorGradeList.size();j++) {
    					SchoolMajorYearAdmission admission=majorGradeList.get(j);
    					
    					
    					if(schoolPlan.getMajorCode().equals(admission.getMajorCode())) {//同一个专业        						
    						if(admission.getYear()==yearNew1) {
    							zyadmission2022=admission;
    						}
    						if(admission.getYear()==yearNew2) {
    							zyadmission2021=admission;
    						}
    						if(admission.getYear()==yearNew3) {
    							zyadmission2020=admission;
    						}
    					}
    				}
    				
    				
    				if(zyadmission2022!=null&&zyadmission2022.getAvgGrade()!=null) {
    					schoolMajorYearAdmission2022.setAvgGradeStr(zyadmission2022.getAvgGrade().toString());
    					schoolMajorYearAdmission2022.setMinGradeStr(zyadmission2022.getLowGrade().toString());
                        schoolMajorYearAdmission2022.setAdmission(zyadmission2022.getAdmission());
    					zyavgGrade2022=zyadmission2022.getAvgGrade();
    					zyminGrade2022=zyadmission2022.getLowGrade();
    					
    					//计算平均分排位，最低分排位
    					int avgGrade2022Seq=99999999;
    					int lastSeq=1;
    					for(int m=0;m<hisPwGradeList.size();m++) {
    						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
    						if(hisGradeDoc.getYear().intValue()==yearNew1) {
    							
    							
    							int myGrade=hisGradeDoc.getGrade();
    							
    							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
    								if(hisGradeDoc.getUseIn().equals("广西")) {
    									int fencha=myGrade-zyavgGrade2022;
    									if(fencha==0) {
    										avgGrade2022Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										avgGrade2022Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    									
    								}
    							}else {
    								if(hisGradeDoc.getUseIn().equals("全国")) {
    									int fencha=myGrade-zyavgGrade2022;
    									if(fencha==0) {
    										avgGrade2022Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										avgGrade2022Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    								}
    							}
    							
    						}
    					}
    					
    					schoolMajorYearAdmission2022.setAvgGradeSeq(new Integer(avgGrade2022Seq).toString());
    					
    					
    					int minGrade2022Seq=99999999;
    					lastSeq=1;
    					for(int m=0;m<hisPwGradeList.size();m++) {
    						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
    						if(hisGradeDoc.getYear().intValue()==yearNew1) {
    							
    							
    							int myGrade=hisGradeDoc.getGrade();
    							
    							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
    								if(hisGradeDoc.getUseIn().equals("广西")) {
    									int fencha=myGrade-zyminGrade2022;
    									if(fencha==0) {
    										minGrade2022Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										minGrade2022Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    									
    								}
    							}else {
    								if(hisGradeDoc.getUseIn().equals("全国")) {
    									int fencha=myGrade-zyminGrade2022;
    									if(fencha==0) {
    										minGrade2022Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										minGrade2022Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    								}
    							}
    							
    						}
    					}
    					
    					schoolMajorYearAdmission2022.setMinGradeSeq(new Integer(minGrade2022Seq).toString());
    					
    					
    				}else {
    					schoolMajorYearAdmission2022.setAvgGradeStr("-");
    					schoolMajorYearAdmission2022.setMinGradeStr("-");
    					schoolMajorYearAdmission2022.setAvgGradeSeq("-");
    					schoolMajorYearAdmission2022.setMinGradeSeq("-");
    					
    				}
    				
    				if(zyadmission2022!=null) {
    					zyplan2022=zyadmission2022.getPlan();
    					
    					schoolMajorYearAdmission2022.setMajorPlan(zyplan2022);
    					
    					if(zyadmission2022.getSubmit()!=null) {
    						zysubmit2022=zyadmission2022.getSubmit();
    					}
    					zyadm2022=zyadmission2022.getAdmission();
    					schoolMajorYearAdmission2022.setPlanSubmitAdmission(plan2022+"-"+adm2022);
    				}

    				SchoolMajorYearAdmission schoolMajorYearAdmission2021=new SchoolMajorYearAdmission();
	        		schoolMajorYearAdmission2021.setYear(yearNew2);
	        		schoolMajorYearAdmission2021.setMajorCode(schoolPlan.getMajorCode());
	        		schoolMajorYearAdmission2021.setMajorSeq(schoolPlan.getMajorSeq());
	        		schoolMajorYearAdmission2021.setMajor(schoolPlan.getMajorName());
	        		schoolMajorYearAdmission2021.setThisYearMajorPlan(schoolPlan.getMajorPlan());
	        		schoolMajorYearAdmission2021.setsCode(schoolPlan.getSchoolCode());
	        		schoolMajorYearAdmission2021.setZyz(schoolPlan.getZyz());
	        		
	        		
	        		if(provinceName.equals("广西")) {
	        			schoolMajorYearAdmission2021.setSeqGrade(new Integer(gxj2021).toString());
	        			schoolMajorYearAdmission2021.setSeq(new Integer(gxpw).toString());
    				}else {
    					schoolMajorYearAdmission2021.setSeqGrade(new Integer(qgj2021).toString());
    					schoolMajorYearAdmission2021.setSeq(new Integer(qgpw).toString());
    				}
    				
    				
    				//设置分数线
    				if("物理".equals(memberQuery.getSxkm())) {
    					schoolMajorYearAdmission2021.setGradeLine(new Integer(gradeLineLg2021).toString());
    				}
    				if("历史".equals(memberQuery.getSxkm())) {
    					schoolMajorYearAdmission2021.setGradeLine(new Integer(gradeLineWs2021).toString());
    				}
    				
    				
    				
    				
    				if(zyadmission2021!=null&&zyadmission2021.getAvgGrade()!=null) {
    					schoolMajorYearAdmission2021.setAvgGradeStr(zyadmission2021.getAvgGrade().toString());
    					schoolMajorYearAdmission2021.setMinGradeStr(zyadmission2021.getLowGrade().toString());
                        schoolMajorYearAdmission2021.setAdmission(zyadmission2021.getAdmission());
    					zyavgGrade2021=zyadmission2021.getAvgGrade();
    					zyminGrade2021=zyadmission2021.getLowGrade();
    					
    					
    					
    					//计算平均分排位，最低分排位
    					int avgGrade2021Seq=99999999;
    					int lastSeq=1;
    					for(int m=0;m<hisPwGradeList.size();m++) {
    						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
    						if(hisGradeDoc.getYear().intValue()==yearNew2) {
    							
    							
    							int myGrade=hisGradeDoc.getGrade();
    							
    							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
    								if(hisGradeDoc.getUseIn().equals("广西")) {
    									int fencha=myGrade-zyavgGrade2021;
    									if(fencha==0) {
    										avgGrade2021Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										avgGrade2021Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    									
    								}
    							}else {
    								if(hisGradeDoc.getUseIn().equals("全国")) {
    									int fencha=myGrade-zyavgGrade2021;
    									if(fencha==0) {
    										avgGrade2021Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										avgGrade2021Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    								}
    							}
    							
    						}
    					}
    					
    					schoolMajorYearAdmission2021.setAvgGradeSeq(new Integer(avgGrade2021Seq).toString());
    					
    					
    					int minGrade2021Seq=99999999;
    					lastSeq=1;
    					for(int m=0;m<hisPwGradeList.size();m++) {
    						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
    						if(hisGradeDoc.getYear().intValue()==yearNew2) {
    							
    							
    							int myGrade=hisGradeDoc.getGrade();
    							
    							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
    								if(hisGradeDoc.getUseIn().equals("广西")) {
    									int fencha=myGrade-zyminGrade2021;
    									if(fencha==0) {
    										minGrade2021Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										minGrade2021Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    									
    								}
    							}else {
    								if(hisGradeDoc.getUseIn().equals("全国")) {
    									int fencha=myGrade-zyminGrade2021;
    									if(fencha==0) {
    										minGrade2021Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										minGrade2021Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    								}
    							}
    							
    						}
    					}
    					
    					schoolMajorYearAdmission2021.setMinGradeSeq(new Integer(minGrade2021Seq).toString());
    					
    					
    					
    				}else {
    					schoolMajorYearAdmission2021.setAvgGradeStr("-");
    					schoolMajorYearAdmission2021.setMinGradeStr("-");
    					schoolMajorYearAdmission2021.setMinGradeSeq("-");
    					schoolMajorYearAdmission2021.setAvgGradeSeq("-");
    				}
    				if(zyadmission2021!=null) {
	    				zyplan2021=zyadmission2021.getPlan();
						schoolMajorYearAdmission2021.setMajorPlan(zyplan2021);
						if(zyadmission2021.getSubmit()!=null) {
							zysubmit2021=zyadmission2021.getSubmit();
						}
						zyadm2021=zyadmission2021.getAdmission();
						schoolMajorYearAdmission2021.setPlanSubmitAdmission(plan2021+"-"+adm2021);
    				}
    				
    				SchoolMajorYearAdmission schoolMajorYearAdmission2020=new SchoolMajorYearAdmission();
	        		schoolMajorYearAdmission2020.setYear(yearNew3);
	        		schoolMajorYearAdmission2020.setMajorCode(schoolPlan.getMajorCode());
	        		schoolMajorYearAdmission2020.setMajorSeq(schoolPlan.getMajorSeq());
	        		schoolMajorYearAdmission2020.setMajor(schoolPlan.getMajorName());
	        		schoolMajorYearAdmission2020.setThisYearMajorPlan(schoolPlan.getMajorPlan());
	        		schoolMajorYearAdmission2020.setsCode(schoolPlan.getSchoolCode());
	        		schoolMajorYearAdmission2020.setZyz(schoolPlan.getZyz());
	        		
	        		
	        		if(provinceName.equals("广西")) {
	        			schoolMajorYearAdmission2020.setSeqGrade(new Integer(gxj2020).toString());
	        			schoolMajorYearAdmission2020.setSeq(new Integer(gxpw).toString());
    				}else {
    					schoolMajorYearAdmission2020.setSeqGrade(new Integer(qgj2020).toString());
    					schoolMajorYearAdmission2020.setSeq(new Integer(qgpw).toString());
    				}
    				
    				
    				//设置分数线
    				if("物理".equals(memberQuery.getSxkm())) {
    					schoolMajorYearAdmission2020.setGradeLine(new Integer(gradeLineLg2020).toString());
    				}
    				if("历史".equals(memberQuery.getSxkm())) {
    					schoolMajorYearAdmission2020.setGradeLine(new Integer(gradeLineWs2020).toString());
    				}
    				
    				
    				
    				if(zyadmission2020!=null&&zyadmission2020.getAvgGrade()!=null) {
    					schoolMajorYearAdmission2020.setAvgGradeStr(zyadmission2020.getAvgGrade().toString());
    					schoolMajorYearAdmission2020.setMinGradeStr(zyadmission2020.getLowGrade().toString());
                        schoolMajorYearAdmission2020.setAdmission(zyadmission2020.getAdmission());
    					zyavgGrade2020=zyadmission2020.getAvgGrade();
    					zyminGrade2020=zyadmission2020.getLowGrade();
    					
    					
    					//计算平均分排位，最低分排位
    					int avgGrade2020Seq=99999999;
    					int lastSeq=1;
    					for(int m=0;m<hisPwGradeList.size();m++) {
    						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
    						if(hisGradeDoc.getYear().intValue()==yearNew3) {
    							
    							
    							int myGrade=hisGradeDoc.getGrade();
    							
    							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
    								if(hisGradeDoc.getUseIn().equals("广西")) {
    									int fencha=myGrade-zyavgGrade2020;
    									if(fencha==0) {
    										avgGrade2020Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										avgGrade2020Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    									
    								}
    							}else {
    								if(hisGradeDoc.getUseIn().equals("全国")) {
    									int fencha=myGrade-zyavgGrade2020;
    									if(fencha==0) {
    										avgGrade2020Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										avgGrade2020Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    								}
    							}
    							
    						}
    					}
    					
    					schoolMajorYearAdmission2020.setAvgGradeSeq(new Integer(avgGrade2020Seq).toString());
    					
    					
    					int minGrade2020Seq=99999999;
    					lastSeq=1;
    					for(int m=0;m<hisPwGradeList.size();m++) {
    						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
    						if(hisGradeDoc.getYear().intValue()==yearNew3) {
    							
    							
    							int myGrade=hisGradeDoc.getGrade();
    							
    							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
    								if(hisGradeDoc.getUseIn().equals("广西")) {
    									int fencha=myGrade-zyminGrade2020;
    									if(fencha==0) {
    										minGrade2020Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										minGrade2020Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    									
    								}
    							}else {
    								if(hisGradeDoc.getUseIn().equals("全国")) {
    									int fencha=myGrade-zyminGrade2020;
    									if(fencha==0) {
    										minGrade2020Seq=hisGradeDoc.getSeq();
    										break;
    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
    										minGrade2020Seq=lastSeq;
    										break;
    									}
    									
    									lastSeq=hisGradeDoc.getSeq();
    								}
    							}
    							
    						}
    					}
    					schoolMajorYearAdmission2020.setMinGradeSeq(new Integer(minGrade2020Seq).toString());
    					
    					
    					
    				}else {
    					schoolMajorYearAdmission2020.setAvgGradeStr("-");
    					schoolMajorYearAdmission2020.setMinGradeStr("-");
    					
    					schoolMajorYearAdmission2020.setAvgGradeSeq("-");
    					schoolMajorYearAdmission2020.setMinGradeSeq("-");
    				}
    				if(zyadmission2020!=null) {
	    				zyplan2020=zyadmission2020.getPlan();
						schoolMajorYearAdmission2020.setMajorPlan(zyplan2020);
						if(zyadmission2020.getSubmit()!=null) {
							zysubmit2020=zyadmission2020.getSubmit();
						}
						zyadm2020=zyadmission2020.getAdmission();
						schoolMajorYearAdmission2020.setPlanSubmitAdmission(plan2020+"-"+adm2020);
    				}
    				
    				
    				
    				//开始计算投档概率
    				/****
    				 * 专科的录取概率计算
    				 * 2024年的分数为a，2023年的院校录取最低分为b,a-b除2—再加50%等于院校专业组投档概率。2024年的分数为c，2023年的专业录取最低分为d,c-d除2—再加50%等于院校专业录取概率。
    				 */
    				if(provinceName.equals("广西")) {//广西学校
    					int userGrade=memberQuery.getGxgrade();
    					double rate=(userGrade-zyminGrade2022)/2+50;
    					if(rate>=100) rate=99.99;
						if(rate<1) rate=1;
						schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
						schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
						schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
    				}else {//全国学校
    					if(qgjfFlag) {//认可加分
    						int userGrade=memberQuery.getQggrade();
        					double rate=(userGrade-zyminGrade2022)/2+50;
        					if(rate>=100) rate=99.99;
							if(rate<1) rate=1;
							schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
							schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
							schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
    					}else {
    						int userGrade=memberQuery.getGrade();
        					double rate=(userGrade-zyminGrade2022)/2+50;
        					if(rate>=100) rate=99.99;
							if(rate<1) rate=1;
							schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
							schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
							schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
    					}
    					
    				}
    				
    				
    				
    				
    				if(schoolMajorYearAdmission2022.getSubmitRate()==null) {
    					schoolMajorYearAdmission2022.setSubmitRate("-");
    				}
    				
    				if(schoolMajorYearAdmission2022.getPlanSubmitAdmission()==null) {
    					schoolMajorYearAdmission2022.setPlanSubmitAdmission("-");
    				}
    				
    				if(schoolMajorYearAdmission2022.getAvgGradeSeq()==null||schoolMajorYearAdmission2022.getAvgGradeSeq().equals("99999999")) {
    					schoolMajorYearAdmission2022.setAvgGradeSeq("-");
    				}
    				
    				if(schoolMajorYearAdmission2022.getMinGradeSeq()==null||schoolMajorYearAdmission2022.getMinGradeSeq().equals("99999999")) {
    					schoolMajorYearAdmission2022.setMinGradeSeq("-");
    				}
    				
    				if(schoolMajorYearAdmission2021.getSubmitRate()==null) {
    					schoolMajorYearAdmission2021.setSubmitRate("-");
    					
    				}
    				if(schoolMajorYearAdmission2021.getPlanSubmitAdmission()==null) {
    					schoolMajorYearAdmission2021.setPlanSubmitAdmission("-");
    				}
    				
    				
    				if(schoolMajorYearAdmission2021.getAvgGradeSeq()==null||schoolMajorYearAdmission2021.getAvgGradeSeq().equals("99999999")) {
    					schoolMajorYearAdmission2021.setAvgGradeSeq("-");
    				}
    				
    				if(schoolMajorYearAdmission2021.getMinGradeSeq()==null||schoolMajorYearAdmission2021.getMinGradeSeq().equals("99999999")) {
    					schoolMajorYearAdmission2021.setMinGradeSeq("-");
    				}
    				
    				if(schoolMajorYearAdmission2020.getSubmitRate()==null) {
    					schoolMajorYearAdmission2020.setSubmitRate("-");
    				}
    				if(schoolMajorYearAdmission2020.getPlanSubmitAdmission()==null) {
    					schoolMajorYearAdmission2020.setPlanSubmitAdmission("-");
    				}
    				
    				if(schoolMajorYearAdmission2022.getMajorPlan()==null) {
    					schoolMajorYearAdmission2022.setMajorPlan(9999);
						schoolMajorYearAdmission2022.setMajorPlanStr("-");
    				}else{
						schoolMajorYearAdmission2022.setMajorPlanStr(schoolMajorYearAdmission2022.getMajorPlan().toString());
					}
    				
    				if(schoolMajorYearAdmission2021.getMajorPlan()==null) {
    					schoolMajorYearAdmission2021.setMajorPlan(9999);
						schoolMajorYearAdmission2022.setMajorPlanStr("-");
					}else{
						schoolMajorYearAdmission2021.setMajorPlanStr(schoolMajorYearAdmission2021.getMajorPlan().toString());
					}
    				
    				if(schoolMajorYearAdmission2020.getMajorPlan()==null) {
    					schoolMajorYearAdmission2020.setMajorPlan(9999);
						schoolMajorYearAdmission2020.setMajorPlanStr("-");
					}else{
						schoolMajorYearAdmission2020.setMajorPlanStr(schoolMajorYearAdmission2020.getMajorPlan().toString());
					}
    				
    				if(schoolMajorYearAdmission2020.getAvgGradeSeq()==null||schoolMajorYearAdmission2020.getAvgGradeSeq().equals("99999999")) {
    					schoolMajorYearAdmission2020.setAvgGradeSeq("-");
    				}
    				
    				if(schoolMajorYearAdmission2020.getMinGradeSeq()==null||schoolMajorYearAdmission2020.getMinGradeSeq().equals("99999999")) {
    					schoolMajorYearAdmission2020.setMinGradeSeq("-");
    				}
    				
    				zyList.add(schoolMajorYearAdmission2022);
    				zyList.add(schoolMajorYearAdmission2021);
    				zyList.add(schoolMajorYearAdmission2020);
    				
    				map.put("zyList", zyList);
    				
    				
    				
    				
    				
	        		
	        	}
	        	
	        	
	        	
	        	
	        	
	        	
	        	
        	}
        	
        	
        }else {
        	return AjaxResult.error("找不到学校信息");
        }
    	
    	
    	return AjaxResult.success(map);
    }


	@ApiOperation("选科专业分析列表")
	@GetMapping("/xuankeZyfx_list")
	public AjaxResult xuankeZyfx_list(String sxkm,String zxkm,String zyName,String userId,Integer pageNum) {

		if (userId == null || userId.equals("")) {
			return AjaxResult.error("请先登录");
		}

		if (isSpecialChar(userId.toString()) || sqlValidate(userId.toString())) {
			AjaxResult.error("参数包含非法字符");
		}

		BuzMember memberQuery = buzMemberService.selectBuzMemberById(userId);

		if (memberQuery != null && memberQuery.getPhone() != null) {

		} else {

			return AjaxResult.error("会员信息不存在，请先注册成为会员");
		}

		if (memberQuery.getSfvip().intValue() == 0) {
			return AjaxResult.error("系统已更新，非会员不能查询");
		}


		School schoolQuery=new School();

		if (isSpecialChar(sxkm.toString()) || sqlValidate(sxkm.toString())) {
			AjaxResult.error("参数包含非法字符");
		}

		if (isSpecialChar(zxkm.toString()) || sqlValidate(zxkm.toString())) {
			AjaxResult.error("参数包含非法字符");
		}


		if ("物理".equals(sxkm)) {
			schoolQuery.setMajorType("理工类");
		}
		if ("历史".equals(sxkm)) {
			schoolQuery.setMajorType("文史类");
		}



		if(zxkm!=null) {
			//考生的再选科目
			schoolQuery.setZxkm(zxkm);
		}

		if (zyName != null && !zyName.trim().equals("")) {

			if (isSpecialChar(zyName.toString()) || sqlValidate(zyName.toString())) {
				AjaxResult.error("参数包含非法字符");
			}
		} else {
			AjaxResult.error("请输入专业名称");
		}
		schoolQuery.setZy(zyName);

		//如果会员不是少数民族，则不能查询民族班
		schoolQuery.setSsmzFlag(0);
		schoolQuery.setGjzxFlag(0);
		schoolQuery.setGxzxFlag(0);


		Map map=new HashMap();


		if(pageNum==null||pageNum.intValue()==0) pageNum=1;
		int pageRow=(pageNum-1)*10;

		schoolQuery.setPageNum(pageRow);

		String schoolCode="";//列表中所有的学校


		List<School> list = schoolService.selectSchoolListByZy4Page(schoolQuery);

		if(list!=null&&list.size()>0) {
			for(int i=0;i<list.size();i++) {
				School school=list.get(i);
				schoolCode=schoolCode+"'"+school.getScode()+"',";
			}
		}

		List<School> returnList =new ArrayList();
		if(!schoolCode.equals("")) {

			schoolCode = schoolCode.substring(0, schoolCode.length() - 1);
			//查询专业组
			SchoolPlan schoolPlanQuery = new SchoolPlan();
			schoolPlanQuery.setYear(thisYear);
			schoolPlanQuery.setSchoolCode(schoolCode);
			if ("物理".equals(sxkm)) {
				schoolPlanQuery.setMajorType("理工类");
			}
			if ("历史".equals(sxkm)) {
				schoolPlanQuery.setMajorType("文史类");
			}

			//如果会员不是少数民族，则不能查询民族班
			schoolPlanQuery.setSsmzFlag(0);
			schoolPlanQuery.setGjzxFlag(0);
			schoolPlanQuery.setGxzxFlag(0);


			//考生的再选科目
			schoolPlanQuery.setZxkm(zxkm);
			schoolPlanQuery.setZy(zyName);


			List<SchoolPlan> plans2023List = schoolPlanService.selectSchoolZyPlan2023List(schoolPlanQuery);

			map.put("zyPlanList",plans2023List);
		}
		return AjaxResult.success(map);
	}

	@ApiOperation("获取模拟填报列表")
	@GetMapping("/getMntbList")
	public AjaxResult getMntbList(String userId) {

		if(StrUtil.isEmpty(userId)) {
			return AjaxResult.error("请先登录");
		}

		if (isSpecialChar(userId.toString()) || sqlValidate(userId.toString())) {
			AjaxResult.error("参数包含非法字符");
		}

		BuzMember memberQuery = buzMemberService.selectBuzMemberById(userId);

		if (memberQuery != null && memberQuery.getPhone() != null) {

		} else {

			return AjaxResult.error("会员信息不存在，请先注册成为会员");
		}

		if (memberQuery.getSfvip().intValue() == 0) {
			return AjaxResult.error("系统已更新，非会员不能查询");
		}

		Map map=new HashMap();

		map.put("member", memberQuery);


		//查询模拟填报列表
		GkZytb zytb=new GkZytb();
		zytb.setMemberId(memberQuery.getId());
		List<GkZytb> list=gkZytbService.selectGkZytbList(zytb);
		map.put("list", list);

		//查询模拟填报详情列表
		GkZytbDetail gkZytbDetail=new GkZytbDetail();
		gkZytbDetail.setUserId(memberQuery.getId());
		List<GkZytbDetail> detailList=gkZytbDetailService.selectGkZytbDetailList(gkZytbDetail);
		map.put("detailList", detailList);
		return AjaxResult.success(map);
	}

	@ApiOperation("下载模拟填报列表")
	@GetMapping("/downloadMntbList")
	public AjaxResult downloadMntbList(String userId) {

		if(StrUtil.isEmpty(userId)) {
			return AjaxResult.error("请先登录");
		}

		if (isSpecialChar(userId.toString()) || sqlValidate(userId.toString())) {
			AjaxResult.error("参数包含非法字符");
		}

		BuzMember memberQuery = buzMemberService.selectBuzMemberById(userId);

		if (memberQuery != null && memberQuery.getPhone() != null) {

		} else {

			return AjaxResult.error("会员信息不存在，请先注册成为会员");
		}

		if (memberQuery.getSfvip().intValue() == 0) {
			return AjaxResult.error("系统已更新，非会员不能查询");
		}

		Map map=new HashMap();




		//查询模拟填报列表
		GkZytb zytb=new GkZytb();
		zytb.setMemberId(memberQuery.getId());
		List<GkZytb> list=gkZytbService.selectGkZytbList(zytb);
		if(list.size()>0){//已经填写了志愿，可以下载

			String down = "https://gaokao.zdwljy.com/web-api/download/mntbExport?userId=" +userId ;
			map.put("down", down);
		}else{//没有填写志愿，不能下载

		}


		return AjaxResult.success(map);
	}



	@ApiOperation("获取单条模拟填报")
	@GetMapping("/getMntbById")
	public AjaxResult getMntbById(String id,String userId) {

		if(StrUtil.isEmpty(userId)) {
			return AjaxResult.error("请先登录");
		}

		if (isSpecialChar(userId.toString()) || sqlValidate(userId.toString())) {
			AjaxResult.error("参数包含非法字符");
		}

		if(StrUtil.isEmpty(id)) {
			return AjaxResult.error("请选择志愿");
		}

		if (isSpecialChar(id.toString()) || sqlValidate(id.toString())) {
			AjaxResult.error("参数包含非法字符");
		}

		BuzMember memberQuery = buzMemberService.selectBuzMemberById(userId);

		if (memberQuery != null && memberQuery.getPhone() != null) {

		} else {

			return AjaxResult.error("会员信息不存在，请先注册成为会员");
		}


		Map map=new HashMap();

		//map.put("member", memberQuery);


		//查询模拟填报信息
		GkZytb zytb=gkZytbService.selectGkZytbById(id);
		map.put("zytb", zytb);
		//查找模拟填报明细
		GkZytbDetail detail = new GkZytbDetail();
		detail.setGkZytbId(id);
		List<GkZytbDetail> detailList=gkZytbDetailService.selectGkZytbDetailList(detail);
		map.put("detailList",detailList);
		return AjaxResult.success(map);
	}

	@ApiOperation("删除单条模拟填报")
	@GetMapping("/delMntbById")
	public AjaxResult delMntbById(String id,String userId) {

		if(StrUtil.isEmpty(userId)) {
			return AjaxResult.error("请先登录");
		}

		if (isSpecialChar(userId.toString()) || sqlValidate(userId.toString())) {
			AjaxResult.error("参数包含非法字符");
		}

		if(StrUtil.isEmpty(id)) {
			return AjaxResult.error("请选择志愿");
		}

		if (isSpecialChar(id.toString()) || sqlValidate(id.toString())) {
			AjaxResult.error("参数包含非法字符");
		}

		BuzMember memberQuery = buzMemberService.selectBuzMemberById(userId);

		if (memberQuery != null && memberQuery.getPhone() != null) {

		} else {

			return AjaxResult.error("会员信息不存在，请先注册成为会员");
		}



		//查询模拟填报信息
		GkZytb zytb=gkZytbService.selectGkZytbById(id);
		if(userId.equals(zytb.getMemberId())){
			gkZytbService.deleteGkZytbById(id);
			gkZytbDetailService.deleteGkZytbDetailByZytbId(id);
		}

		return AjaxResult.success();
	}

		@ApiOperation("选科专业分析总页数")
	@GetMapping("/xuankeZyfxListTotal")
	public AjaxResult xuankeZyfxListTotal(String sxkm,String zxkm,String zyName,String userId) {

		if (userId == null || userId.equals("")) {
			return AjaxResult.error("请先登录");
		}

		if (isSpecialChar(userId.toString()) || sqlValidate(userId.toString())) {
			AjaxResult.error("参数包含非法字符");
		}

		BuzMember memberQuery = buzMemberService.selectBuzMemberById(userId);

		if (memberQuery != null && memberQuery.getPhone() != null) {

		} else {

			return AjaxResult.error("会员信息不存在，请先注册成为会员");
		}

		if (memberQuery.getSfvip().intValue() == 0) {
			return AjaxResult.error("系统已更新，非会员不能查询");
		}


		School schoolQuery=new School();

		if (isSpecialChar(sxkm.toString()) || sqlValidate(sxkm.toString())) {
			AjaxResult.error("参数包含非法字符");
		}

		if (isSpecialChar(zxkm.toString()) || sqlValidate(zxkm.toString())) {
			AjaxResult.error("参数包含非法字符");
		}


		if ("物理".equals(sxkm)) {
			schoolQuery.setMajorType("理工类");
		}
		if ("历史".equals(sxkm)) {
			schoolQuery.setMajorType("文史类");
		}



		if(zxkm!=null) {
			//考生的再选科目
			schoolQuery.setZxkm(zxkm);
		}

		if (zyName != null && !zyName.trim().equals("")) {

			if (isSpecialChar(zyName.toString()) || sqlValidate(zyName.toString())) {
				AjaxResult.error("参数包含非法字符");
			}
		} else {
			AjaxResult.error("请输入专业名称");
		}
		schoolQuery.setZy(zyName);

		//如果会员不是少数民族，则不能查询民族班
		schoolQuery.setSsmzFlag(0);
		schoolQuery.setGjzxFlag(0);
		schoolQuery.setGxzxFlag(0);



		List<School> list = schoolService.selectSchoolListBy2024(schoolQuery);


		return AjaxResult.success(list.size());
	}


		@ApiOperation("专业分析列表")
    @GetMapping("/zyfx_list")
    public AjaxResult zyfx_list(String zyName,String province,String batch,String userId,Integer pageNum)
    {
    	
    	if(userId==null||userId.equals("")) {
    		return AjaxResult.error("请先登录");
    	}
    	
    	if(isSpecialChar(userId.toString())||sqlValidate(userId.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	BuzMember memberQuery=buzMemberService.selectBuzMemberById(userId);

    	if(memberQuery!=null&&memberQuery.getPhone()!=null) {
    		
    	}else {
    		
    		return AjaxResult.error("会员信息不存在，请先注册成为会员");
    	}
    	
    	if(memberQuery.getSfvip().intValue()==0) {
        	return AjaxResult.error("系统已更新，非会员不能查询");
        }
    	
    	if(zyName!=null&&!zyName.trim().equals("")) {
    		
    		if(isSpecialChar(zyName.toString())||sqlValidate(zyName.toString())){
        		AjaxResult.error("参数包含非法字符");
        	}
    	}else {
    		AjaxResult.error("请输入专业名称");
    	}

		//查找会员的同位分
		BuzMemberGrade memberGradeQuery=new BuzMemberGrade();
		memberGradeQuery.setMemberId(memberQuery.getId());
		List<BuzMemberGrade> memberGradeList=buzMemberGradeService.selectBuzMemberGradeList(memberGradeQuery);

        
        List<School> returnList =new ArrayList();

        //查询专业组
        SchoolPlan schoolPlanQuery=new SchoolPlan();
        schoolPlanQuery.setYear(thisYear);
        if("物理".equals(memberQuery.getSxkm())) {
            schoolPlanQuery.setMajorType("理工类");
        }
        if("历史".equals(memberQuery.getSxkm())) {
            schoolPlanQuery.setMajorType("文史类");
        }

        //如果会员不是少数民族，则不能查询民族班
        if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
            schoolPlanQuery.setSsmzFlag(0);
        }

        if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
            schoolPlanQuery.setGjzxFlag(0);
        }

        if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
            schoolPlanQuery.setGxzxFlag(0);
        }

        //考生的再选科目
        schoolPlanQuery.setZxkm(memberQuery.getZxkm());
        schoolPlanQuery.setZy(zyName);

        if(province!=null&&!province.equals("")) {

            if(isSpecialChar(province.toString())||sqlValidate(province.toString())){
                AjaxResult.error("参数包含非法字符");
            }
            if(province.charAt(province.length()-1)==',') {
                province = province.substring(0, province.length() - 1);
            }
            schoolPlanQuery.setSprovince(province);
        }

        if(pageNum==null||pageNum.intValue()==0) pageNum=1;
        int pageRow=(pageNum-1)*10;

        schoolPlanQuery.setPageNum(pageRow);
		schoolPlanQuery.setGrade(memberQuery.getGrade());
        	
        //查找2024年满足条件的专业
        List<SchoolPlan> zyzList =schoolPlanService.selectSchoolZyPlanList4Page(schoolPlanQuery);

		//查询今年的招生计划数
		schoolPlanQuery.setYear(thisYear);
        List<SchoolPlan> thisYearPlanList=schoolPlanService.selectSchoolPlanList(schoolPlanQuery);

        /**
         * 2025-05-03 专业组投档概率计算=(考生成绩-2024年录取最低分)/2+50
         *
         * double finalRate = (memberGrade - grade) / 2 + 50;
         *
         * 									if(finalRate>=100) finalRate=99.99;
         * 									if(finalRate<1) finalRate=1;
		 * 	所以不需要取专业组近3年的数据了
         */


        String schoolCode="";//列表中所有的学校
        if(zyzList!=null&&zyzList.size()>0) {
            for(int i=0;i<zyzList.size();i++) {
                SchoolPlan school=zyzList.get(i);
                schoolCode=schoolCode+"'"+school.getSchoolCode()+"',";
            }
            schoolCode=schoolCode.substring(0,schoolCode.length()-1);
        }

		schoolPlanQuery.setSchoolCode(schoolCode);
		List<SchoolPlan> plans2024List =schoolPlanService.selectSchoolZyz2024PlanList(schoolPlanQuery);

		DecimalFormat df = new DecimalFormat("#.00");


		//该专业组下各专业录取概率
		List<SchoolMajorYearAdmission> zyList =new ArrayList();

		//需要查找每个专业近3年的数据
		String zyCode="";//列表中所有的专业编码
		if(zyzList!=null&&zyzList.size()>0) {
			for(int i=0;i<zyzList.size();i++) {
				SchoolPlan school=zyzList.get(i);
				zyCode=zyCode+"'"+school.getMajorCode()+"',";
			}
			zyCode=zyCode.substring(0,zyCode.length()-1);
		}
		schoolPlanQuery.setYear3(yearNew1+","+yearNew2+","+yearNew3);
		schoolPlanQuery.setMajorName(zyCode);
		List<SchoolPlan> majorList =schoolPlanService.selectSchoolMajorList3Year(schoolPlanQuery);



		List<SysDictData> data = dictTypeService.selectDictDataByType("school_level");
        	

        	
        	//循环专业列表信息，里面需要计算专业组投档概率和专业投档概率
        	for(int y=0;y< zyzList.size();y++) {
        		SchoolPlan zyzPlan=zyzList.get(y);//取出专业组

				//2024年录取最低分
				Integer grade2024=zyzPlan.getGrade();
				String provinceName=zyzPlan.getProvinceName();
				//专业组投档概率
				Integer zyzAdminssRate=0;

				/**
				 * 需要判断该专业的学校是省内还是省外，确定用广西分还是全国分
				 */
				if(provinceName!=null) {
					if(provinceName.equals("广西")) {
						//Integer cha = memberQuery.getGxgrade() - grade2024;
						//zyzAdminssRate = cha.intValue() / 2 + 50;

						float cha= (float)(memberQuery.getGxgrade() - grade2024) / 2;
						if(cha>0) cha=cha+1;
						if(cha<0) cha=cha-1;
						double finalRate = cha + 50;
						zyzAdminssRate=new Double (finalRate).intValue();

					}else{
						//Integer cha = memberQuery.getQggrade() - grade2024;
						//zyzAdminssRate = cha.intValue() / 2 + 50;

                        //zyzAdminssRate = cha.intValue() / 2 + 50;

                        float cha= (float)(memberQuery.getQggrade() - grade2024) / 2;
                        if(cha>0) cha=cha+1;
                        if(cha<0) cha=cha-1;
                        double finalRate = cha + 50;
                        zyzAdminssRate=new Double (finalRate).intValue();
					}
				}
				if(zyzAdminssRate>=100) zyzAdminssRate=99;
				if(zyzAdminssRate<1) zyzAdminssRate=1;
				zyzPlan.setZyzAdminssRate(zyzAdminssRate);

				/**
				 * 院校特性
				 */
				String stypes=zyzPlan.getStypes();
				System.out.println("-------------------------stypes------"+stypes);
				if(stypes!=null) {
					String[] stypesArr=stypes.split(",");
					String stypesName="";
					for(int k=0;k<stypesArr.length;k++) {
						String s=stypesArr[k];
						for (int u = 0; u < data.size(); u++) {
							SysDictData stypesData = data.get(u);
							//System.out.println("-------------------------stypesData.getDictValue()------"+stypesData.getDictValue()+"----;--stypesData.getDictLabel()--"+stypesData.getDictLabel());
							if (stypesData.getDictValue().equals(s)){
								stypesName=stypesName+stypesData.getDictLabel()+",";

							}
						}
					}
					if(stypesName.length()>0){

						stypesName=stypesName.substring(0,stypesName.length()-1);

						zyzPlan.setStypes(stypesName);
					}
                }


                School returnSchool=new School();
                returnSchool.setProvinceName(provinceName);
                returnSchool.setScode(zyzPlan.getSchoolCode());
                returnSchool.setSname(zyzPlan.getSchoolName());
                returnSchool.setZyz(zyzPlan.getZyz());
                returnSchool.setZxkm(zyzPlan.getKm2());
                returnSchool.setSranking(zyzPlan.getSchoolPm());
                returnSchool.setMajorName(zyzPlan.getMajorName());
                returnSchool.setThisYearMajorPlan(zyzPlan.getMajorPlan());
                returnSchool.setSubmitRate(zyzAdminssRate.toString());//专业组投档概率
                returnSchool.setZy(zyzPlan.getMajorCode());
                returnSchool.setMajorPm(zyzPlan.getMajorPm());
				returnSchool.setStypes(zyzPlan.getStypes());

				/*******************************************
				 *
				 * 计算该专业组下的各专业的录取概率
				 *
				 */

				int zyavgGrade2022=0;
				int zyminGrade2022=0;
				int zyavgGrade2021=0;
				int zyminGrade2021=0;
				int zyavgGrade2020=0;
				int zyminGrade2020=0;

				//考生近3年的广西排位
				int gxj2022=0;
				int gxj2021=0;
				int gxj2020=0;
				//考生近3年全国排位分
				int qgj2022=0;
				int qgj2021=0;
				int qgj2020=0;

				/**
				 * 计算当年的排名和对应的分数
				 */
				if (provinceName.equals("广西")) {
					if (memberGradeList != null && memberGradeList.size() > 0) {
						for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
							BuzMemberGrade memberGrade = memberGradeList.get(k1);
							if (memberGrade.getYear().intValue() == yearNew1) {
								if (memberGrade.getPmGradeGx() != null) {
									gxj2022=memberGrade.getPmGradeGx();
								}
							}
							if (memberGrade.getYear().intValue() == yearNew2) {
								if (memberGrade.getPmGradeGx() != null) {
									gxj2021=memberGrade.getPmGradeGx();
								}
							}
							if (memberGrade.getYear().intValue() == yearNew3) {
								if (memberGrade.getPmGradeGx() != null) {
									gxj2020=memberGrade.getPmGradeGx();
								}
							}
						}
					}
				} else {
					if (memberGradeList != null && memberGradeList.size() > 0) {
						for (int k1 = 0; k1 < memberGradeList.size(); k1++) {
							BuzMemberGrade memberGrade = memberGradeList.get(k1);
							if (memberGrade.getYear().intValue() == yearNew1) {
								if (memberGrade.getPmGradeGx() != null) {
									qgj2022=memberGrade.getPmGrade();
								}
							}
							if (memberGrade.getYear().intValue() == yearNew2) {
								if (memberGrade.getPmGradeGx() != null) {
									qgj2021=memberGrade.getPmGrade();
								}
							}
							if (memberGrade.getYear().intValue() == yearNew3) {
								if (memberGrade.getPmGradeGx() != null) {
									qgj2020=memberGrade.getPmGrade();
								}
							}
						}
					}
				}


				double zySubmitRate=0;
				double finalZySubmitRate=0;

	        	//近3年的专业数据
	        	for(int k=0;k<majorList.size();k++) {
					SchoolPlan schoolPlan = majorList.get(k);
					if (zyzPlan.getSchoolCode().equals(schoolPlan.getSchoolCode()) &&
							schoolPlan.getZyz().equals(zyzPlan.getZyz()) &&
							zyzPlan.getMajorCode().equals(schoolPlan.getMajorCode())) {

						if (schoolPlan.getYear().intValue() == yearNew1) {
							if (schoolPlan.getMajorAvgGrade() != null) {
								zyavgGrade2022 = schoolPlan.getMajorAvgGrade();
							}
							if (schoolPlan.getMajorLowGrade() != null) {
								zyminGrade2022 = schoolPlan.getMajorLowGrade();
							}
						}

						if (schoolPlan.getYear().intValue() == yearNew2) {
							if (schoolPlan.getMajorAvgGrade() != null) {
								zyavgGrade2021 = schoolPlan.getMajorAvgGrade();
							}
							if (schoolPlan.getMajorLowGrade() != null) {
								zyminGrade2021 = schoolPlan.getMajorLowGrade();
							}
						}

						if (schoolPlan.getYear().intValue() == yearNew3) {
							if (schoolPlan.getMajorAvgGrade() != null) {
								zyavgGrade2020 = schoolPlan.getMajorAvgGrade();
							}
							if (schoolPlan.getMajorLowGrade() != null) {
								zyminGrade2020 = schoolPlan.getMajorLowGrade();
							}
						}


						if(provinceName.equals("广西")) {
							int memberGxGrade=memberQuery.getGxgrade();
							int yearLowGrade=zyminGrade2022;
							if(yearLowGrade==0)	yearLowGrade=zyminGrade2021;
							if(yearLowGrade==0)	yearLowGrade=zyminGrade2020;
							if(memberGxGrade==yearLowGrade){
								zySubmitRate=50;

							}else{
								float cha=(float)(memberGxGrade-yearLowGrade)/2;
								if(cha<0){
									cha=cha-1+50;
								}else{
									cha=cha+1+50;
								}
								if(cha>=100) cha=99.99f;
								if(cha<1) cha=1;
								zySubmitRate=cha;

							}
						}else{
							int memberGxGrade=memberQuery.getQggrade();
							int yearLowGrade=zyminGrade2022;
							if(yearLowGrade==0)	yearLowGrade=zyminGrade2021;
							if(yearLowGrade==0)	yearLowGrade=zyminGrade2020;
							if(memberGxGrade==yearLowGrade){
								zySubmitRate=50;
							}else{
								float cha=(float)(memberGxGrade-yearLowGrade)/2;
								if(cha<0){
									cha=cha-1+50;
								}else{
									cha=cha+1+50;
								}
								if(cha>=100) cha=99.99f;
								if(cha<1) cha=1;
								zySubmitRate=cha;
							}
						}
						returnSchool.setSubmitZyRate(df.format(zySubmitRate));//专业投档概率


						/*

						if (zyavgGrade2020 > 0 && zyavgGrade2021 > 0 && zyavgGrade2022 > 0) {//3年都有数据
							if (provinceName.equals("广西")) {
								if (gxj2020 - zyavgGrade2020 > 0 && gxj2021 - zyavgGrade2021 > 0 && gxj2022 - zyavgGrade2022 > 0) {//3年的同位分都比录取平均分高
									double rate = ((gxj2022 - zyavgGrade2022) / 2 + 80) * 0.55 + ((gxj2021 - zyavgGrade2021) / 2 + 80) * 0.3 + ((gxj2020 - zyavgGrade2020) / 2 + 80) * 0.15;


									if (rate >= 100) rate = 99.99;
									if (rate < 1) rate = 1;
									zySubmitRate = rate;
								} else {
									double rate = 0;
									//2年高于
									int count = 0;
									if (gxj2022 - zyavgGrade2022 > 0) {
										count++;
									}
									if (gxj2021 - zyavgGrade2021 > 0) {
										count++;
									}
									if (gxj2020 - zyavgGrade2020 > 0) {
										count++;
									}
									if (count == 2) {//有2年高于同位分的

										if (gxj2022 - zyavgGrade2022 > 0) {
											rate = rate + ((gxj2022 - zyavgGrade2022) / 2 + 70) * 0.55;
										} else {
											rate = rate + ((gxj2022 - zyminGrade2022) / 2 + 50) * 0.55;
										}

										if (gxj2021 - zyavgGrade2021 > 0) {
											rate = rate + ((gxj2021 - zyavgGrade2021) / 2 + 70) * 0.3;
										} else {
											rate = rate + ((gxj2021 - zyminGrade2021) / 2 + 50) * 0.3;
										}

										if (gxj2020 - zyavgGrade2020 > 0) {
											rate = rate + ((gxj2020 - zyavgGrade2020) / 2 + 70) * 0.15;
										} else {
											rate = rate + ((gxj2020 - zyminGrade2020) / 2 + 50) * 0.15;
										}
									} else if (count == 1) {//有1年高于同位分的

										if (gxj2022 - zyavgGrade2022 > 0) {
											rate = rate + ((gxj2022 - zyavgGrade2022) / 2 + 60) * 0.55;
										} else {
											rate = rate + ((gxj2022 - zyminGrade2022) / 2 + 50) * 0.55;
										}

										if (gxj2021 - zyavgGrade2021 > 0) {
											rate = rate + ((gxj2021 - zyavgGrade2021) / 2 + 60) * 0.3;
										} else {
											rate = rate + ((gxj2021 - zyminGrade2021) / 2 + 50) * 0.3;
										}

										if (gxj2020 - zyavgGrade2020 > 0) {
											rate = rate + ((gxj2020 - zyavgGrade2020) / 2 + 60) * 0.15;
										} else {
											rate = rate + ((gxj2020 - zyminGrade2020) / 2 + 50) * 0.15;
										}

									} else {//一个高于的都没有
										rate = ((gxj2022 - zyminGrade2022) / 2 + 50) * 0.55 + ((gxj2021 - zyminGrade2021) / 2 + 50) * 0.3 + ((gxj2020 - zyminGrade2020) / 2 + 50) * 0.15;
									}


									if (rate >= 100) rate = 99.99;
									if (rate < 1) rate = 1;
									zySubmitRate = rate;
								}
							} else {//全国学校，用全国同位分
								if (qgj2020 - zyavgGrade2020 > 0 && qgj2021 - zyavgGrade2021 > 0 && qgj2022 - zyavgGrade2022 > 0) {//3年的同位分都比录取平均分高
									double rate = ((qgj2022 - zyavgGrade2022) / 2 + 80) * 0.55 + ((qgj2021 - zyavgGrade2021) / 2 + 80) * 0.3 + ((qgj2020 - zyavgGrade2020) / 2 + 80) * 0.15;

									if (rate >= 100) rate = 99.99;
									if (rate < 1) rate = 1;
									zySubmitRate = rate;
								} else {
									double rate = 0;
									//2年高于
									int count = 0;
									if (qgj2022 - zyavgGrade2022 > 0) {
										count++;
									}
									if (qgj2021 - zyavgGrade2021 > 0) {
										count++;
									}
									if (qgj2020 - zyavgGrade2020 > 0) {
										count++;
									}
									if (count == 2) {//有2年高于同位分的

										if (qgj2022 - zyavgGrade2022 > 0) {
											rate = rate + ((qgj2022 - zyavgGrade2022) / 2 + 70) * 0.55;
										} else {
											rate = rate + ((qgj2022 - zyminGrade2022) / 2 + 50) * 0.55;
										}

										if (qgj2021 - zyavgGrade2021 > 0) {
											rate = rate + ((qgj2021 - zyavgGrade2021) / 2 + 70) * 0.3;
										} else {
											rate = rate + ((qgj2021 - zyminGrade2021) / 2 + 50) * 0.3;
										}

										if (qgj2020 - zyavgGrade2020 > 0) {
											rate = rate + ((qgj2020 - zyavgGrade2020) / 2 + 70) * 0.15;
										} else {
											rate = rate + ((qgj2020 - zyminGrade2020) / 2 + 50) * 0.15;
										}
									} else if (count == 1) {//有1年高于同位分的

										if (qgj2022 - zyavgGrade2022 > 0) {
											rate = rate + ((qgj2022 - zyavgGrade2022) / 2 + 60) * 0.55;
										} else {
											rate = rate + ((qgj2022 - zyminGrade2022) / 2 + 50) * 0.55;
										}

										if (qgj2021 - zyavgGrade2021 > 0) {
											rate = rate + ((qgj2021 - zyavgGrade2021) / 2 + 60) * 0.3;
										} else {
											rate = rate + ((qgj2021 - zyminGrade2021) / 2 + 50) * 0.3;
										}

										if (qgj2020 - zyavgGrade2020 > 0) {
											rate = rate + ((qgj2020 - zyavgGrade2020) / 2 + 60) * 0.15;
										} else {
											rate = rate + ((qgj2020 - zyminGrade2020) / 2 + 50) * 0.15;
										}

									} else {//一个高于的都没有
										rate = ((qgj2022 - zyminGrade2022) / 2 + 50) * 0.55 + ((qgj2021 - zyminGrade2021) / 2 + 50) * 0.3 + ((qgj2020 - zyminGrade2020) / 2 + 50) * 0.15;
									}


									if (rate >= 100) rate = 99.99;
									if (rate < 1) rate = 1;
									zySubmitRate = rate;
								}
							}
						} else {//数据不满3年
							int years = 0;
							if (zyavgGrade2020 > 0) years++;
							if (zyavgGrade2021 > 0) years++;
							if (zyavgGrade2022 > 0) years++;
							if (years == 2) {
								double rate = 0;
								if (provinceName.equals("广西")) {
									int heightYears = 0;//这两年中，同位分大于平均分的年份数=2，则+70，如果年份数=1，则+60，都不大于平均分，则+50
									if (zyavgGrade2022 > 0 && gxj2022 - zyavgGrade2022 > 0) heightYears++;
									if (zyavgGrade2021 > 0 && gxj2021 - zyavgGrade2021 > 0) heightYears++;
									if (zyavgGrade2020 > 0 && gxj2020 - zyavgGrade2020 > 0) heightYears++;

									if (zyavgGrade2022 > 0) {//2022年有数据
										if (heightYears == 2) {
											double rate1 = ((gxj2022 - zyavgGrade2022) / 2 + 70) * 0.60;
											rate = rate + rate1;

											if (zyavgGrade2021 > 0) {
												double rate2 = ((gxj2021 - zyavgGrade2021) / 2 + 70) * 0.40;
												rate = rate + rate2;
											} else {
												double rate2 = ((gxj2020 - zyavgGrade2020) / 2 + 70) * 0.40;
												rate = rate + rate2;
											}
										} else if (heightYears == 1) {
											if (gxj2022 - zyavgGrade2022 > 0) {
												double rate1 = ((gxj2022 - zyavgGrade2022) / 2 + 60) * 0.60;
												rate = rate + rate1;
											} else {
												double rate1 = ((gxj2022 - zyminGrade2022) / 2 + 50) * 0.60;
												rate = rate + rate1;
											}
											if (zyavgGrade2021 > 0) {
												if (gxj2021 - zyavgGrade2021 > 0) {
													double rate1 = ((gxj2021 - zyavgGrade2021) / 2 + 60) * 0.40;
													rate = rate + rate1;
												} else {
													double rate1 = ((gxj2021 - zyminGrade2021) / 2 + 60) * 0.40;
													rate = rate + rate1;
												}
											} else {
												if (gxj2020 - zyavgGrade2020 > 0) {
													double rate1 = ((gxj2020 - zyavgGrade2020) / 2 + 60) * 0.40;
													rate = rate + rate1;
												} else {
													double rate1 = ((gxj2020 - zyminGrade2020) / 2 + 60) * 0.40;
													rate = rate + rate1;
												}
											}
										} else {//都不高于平均分
											double rate1 = ((gxj2022 - zyminGrade2022) / 2 + 50) * 0.60;
											rate = rate + rate1;
											if (zyavgGrade2021 > 0) {
												double rate2 = ((gxj2021 - zyminGrade2021) / 2 + 50) * 0.60;
												rate = rate + rate2;
											} else {
												double rate2 = ((gxj2020 - zyminGrade2020) / 2 + 50) * 0.40;
												rate = rate + rate2;
											}
										}
									} else {//2022年没数据，只有2021和2020年数据
										if (heightYears == 2) {
											double rate1 = ((gxj2021 - zyavgGrade2021) / 2 + 70) * 0.60 + ((gxj2020 - zyavgGrade2020) / 2 + 70) * 0.40;
											rate = rate + rate1;
										} else if (heightYears == 1) {
											if (gxj2021 - zyavgGrade2021 > 0) {
												double rate1 = ((gxj2021 - zyavgGrade2021) / 2 + 60) * 0.60;
												rate = rate + rate1;
											} else {
												double rate1 = ((gxj2021 - zyminGrade2021) / 2 + 50) * 0.60;
												rate = rate + rate1;
											}
											if (gxj2020 - zyavgGrade2020 > 0) {
												double rate1 = ((gxj2020 - zyavgGrade2020) / 2 + 60) * 0.40;
												rate = rate + rate1;
											} else {
												double rate1 = ((gxj2020 - zyminGrade2020) / 2 + 50) * 0.40;
												rate = rate + rate1;
											}
										} else {
											double rate1 = ((gxj2021 - zyminGrade2021) / 2 + 50) * 0.60;
											rate = rate + rate1;

											double rate2 = ((gxj2020 - zyminGrade2020) / 2 + 50) * 0.40;
											rate = rate + rate2;
										}
									}
								} else {//只有2年数据，全国的
									int heightYears = 0;//这两年中，同位分大于平均分的年份数=2，则+70，如果年份数=1，则+60，都不大于平均分，则+50
									if (zyavgGrade2022 > 0 && qgj2022 - zyavgGrade2022 > 0) heightYears++;
									if (zyavgGrade2021 > 0 && qgj2021 - zyavgGrade2021 > 0) heightYears++;
									if (zyavgGrade2020 > 0 && qgj2020 - zyavgGrade2020 > 0) heightYears++;

									if (zyavgGrade2022 > 0) {//2022年有数据
										if (heightYears == 2) {
											double rate1 = ((qgj2022 - zyavgGrade2022) / 2 + 70) * 0.60;
											rate = rate + rate1;

											if (zyavgGrade2021 > 0) {
												double rate2 = ((qgj2021 - zyavgGrade2021) / 2 + 70) * 0.40;
												rate = rate + rate2;
											} else {
												double rate2 = ((qgj2020 - zyavgGrade2020) / 2 + 70) * 0.40;
												rate = rate + rate2;
											}
										} else if (heightYears == 1) {
											if (qgj2022 - zyavgGrade2022 > 0) {
												double rate1 = ((qgj2022 - zyavgGrade2022) / 2 + 60) * 0.60;
												rate = rate + rate1;
											} else {
												double rate1 = ((qgj2022 - zyminGrade2022) / 2 + 50) * 0.60;
												rate = rate + rate1;
											}
											if (zyavgGrade2021 > 0) {
												if (qgj2021 - zyavgGrade2021 > 0) {
													double rate1 = ((qgj2021 - zyavgGrade2021) / 2 + 60) * 0.40;
													rate = rate + rate1;
												} else {
													double rate1 = ((qgj2021 - zyminGrade2021) / 2 + 60) * 0.40;
													rate = rate + rate1;
												}
											} else {
												if (qgj2020 - zyavgGrade2020 > 0) {
													double rate1 = ((qgj2020 - zyavgGrade2020) / 2 + 60) * 0.40;
													rate = rate + rate1;
												} else {
													double rate1 = ((qgj2020 - zyminGrade2020) / 2 + 60) * 0.40;
													rate = rate + rate1;
												}
											}
										} else {//都不高于平均分
											double rate1 = ((qgj2022 - zyminGrade2022) / 2 + 50) * 0.60;
											rate = rate + rate1;
											if (zyavgGrade2021 > 0) {
												double rate2 = ((qgj2021 - zyminGrade2021) / 2 + 50) * 0.60;
												rate = rate + rate2;
											} else {
												double rate2 = ((qgj2020 - zyminGrade2020) / 2 + 50) * 0.40;
												rate = rate + rate2;
											}
										}
									} else {//2022年没数据，只有2021和2020年数据
										if (heightYears == 2) {
											double rate1 = ((qgj2021 - zyavgGrade2021) / 2 + 70) * 0.60 + ((qgj2020 - zyavgGrade2020) / 2 + 70) * 0.40;
											rate = rate + rate1;
										} else if (heightYears == 1) {
											if (qgj2021 - zyavgGrade2021 > 0) {
												double rate1 = ((qgj2021 - zyavgGrade2021) / 2 + 60) * 0.60;
												rate = rate + rate1;
											} else {
												double rate1 = ((qgj2021 - zyminGrade2021) / 2 + 50) * 0.60;
												rate = rate + rate1;
											}
											if (qgj2020 - zyavgGrade2020 > 0) {
												double rate1 = ((qgj2020 - zyavgGrade2020) / 2 + 60) * 0.40;
												rate = rate + rate1;
											} else {
												double rate1 = ((qgj2020 - zyminGrade2020) / 2 + 50) * 0.40;
												rate = rate + rate1;
											}
										} else {
											double rate1 = ((qgj2021 - zyminGrade2021) / 2 + 50) * 0.60;
											rate = rate + rate1;

											double rate2 = ((qgj2020 - zyminGrade2020) / 2 + 50) * 0.40;
											rate = rate + rate2;
										}
									}

								}


								if (rate >= 100) rate = 99.99;
								if (rate < 1) rate = 1;
								zySubmitRate = rate;
							} else {//只有一年数据
								if (provinceName.equals("广西")) {

									if (zyavgGrade2022 > 0) {
										double rate = ((gxj2022 - zyminGrade2022) / 2) + 50;

										if (rate >= 100) rate = 99.99;
										if (rate < 1) rate = 1;
										zySubmitRate = rate;
									}
									if (zyavgGrade2021 > 0) {
										double rate = ((gxj2021 - zyminGrade2021) / 2) + 50;

										if (rate >= 100) rate = 99.99;
										if (rate < 1) rate = 1;
										zySubmitRate = rate;
									}
									if (zyavgGrade2020 > 0) {
										double rate = ((gxj2020 - zyminGrade2020) / 2) + 50;

										if (rate >= 100) rate = 99.99;
										if (rate < 1) rate = 1;
										zySubmitRate = rate;
									}
								} else {//全国只有一年数据
									if (zyavgGrade2022 > 0) {
										double rate = ((qgj2022 - zyminGrade2022) / 2) + 50;

										if (rate >= 100) rate = 99.99;
										if (rate < 1) rate = 1;
										zySubmitRate = rate;
									}
									if (zyavgGrade2021 > 0) {
										double rate = ((qgj2021 - zyminGrade2021) / 2) + 50;

										if (rate >= 100) rate = 99.99;
										if (rate < 1) rate = 1;
										zySubmitRate = rate;
									}
									if (zyavgGrade2020 > 0) {
										double rate = ((qgj2020 - zyminGrade2020) / 2) + 50;

										if (rate >= 100) rate = 99.99;
										if (rate < 1) rate = 1;
										zySubmitRate = rate;
									}
								}
							}
						}

						 */
					}
				}

						/*
					专业的录取概率:(今年的院校专业组投档概率X80%+现在系统显示的录取概率Ⅹ20%）
					 */
				/*
						for(int s=0;s<plans2024List.size();s++){
							SchoolPlan plan2024= plans2024List.get(s);
							//学校和专业组相等
							if(plan2024.getSchoolCode().equals(zyzPlan.getSchoolCode())
									&&plan2024.getZyz().equals(zyzPlan.getZyz())){
								//最低录取分数线
								int grade=plan2024.getGrade();
								if(provinceName!=null){
									if(provinceName.equals("广西")) {
										int memberGrade=memberQuery.getGxgrade();
										//((考生成绩-录取最低分)/2+50)*0.8+schoolRecord2022.getSubmitRate()*0.2
										//finalZySubmitRate = ((memberGrade - grade) / 2 + 50) * 0.8 + zySubmitRate * 0.2;


										float cha= (float)(memberGrade - grade) / 2;
										if(cha>0) cha=cha+1;
										if(cha<0) cha=cha-1;
										double finalRate = cha + 50;
										finalZySubmitRate=new Double (finalRate).intValue();

										if(finalZySubmitRate>=100) finalZySubmitRate=99.99;
										if(finalZySubmitRate<1) finalZySubmitRate=1;

									}else {
										int memberGrade=memberQuery.getQggrade();
										//((考生成绩-录取最低分)/2+50)*0.8+schoolRecord2022.getSubmitRate()*0.2
										//finalZySubmitRate = ((memberGrade - grade) / 2 + 50) * 0.8 + zySubmitRate * 0.2;



										float cha= (float)(memberGrade - grade) / 2;
										if(cha>0) cha=cha+1;
										if(cha<0) cha=cha-1;
										double finalRate = cha + 50;
										finalZySubmitRate=new Double (finalRate).intValue();

										if(finalZySubmitRate>=100) finalZySubmitRate=99.99;
										if(finalZySubmitRate<1) finalZySubmitRate=1;
									}
									returnSchool.setSubmitZyRate(df.format(finalZySubmitRate));//专业投档概率
								}else {
									returnSchool.setSubmitZyRate("-");//专业投档概率
								}
							}
						}
				*/
                for(int k=0;k<thisYearPlanList.size();k++) {
                    SchoolPlan schoolPlan = thisYearPlanList.get(k);
                    if (schoolPlan.getZyz().equals(zyzPlan.getZyz()) &&
                            schoolPlan.getSchoolCode().equals(zyzPlan.getSchoolCode()) ) {
                        returnSchool.setThisYearZyzPlan(schoolPlan.getZyzPlan());
                    }
                }

                returnList.add(returnSchool);
        	}

    	return AjaxResult.success(returnList);
    }
    
    
    
    @ApiOperation("专科专业分析列表")
    @GetMapping("/zyfx_list_zk")
    public AjaxResult zyfx_list_zk(String zyName,String batch,String userId,Integer pageNum)
    {
    	
    	if(userId==null||userId.equals("")) {
    		return AjaxResult.error("请先登录");
    	}
    	
    	if(isSpecialChar(userId.toString())||sqlValidate(userId.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	BuzMember memberQuery=buzMemberService.selectBuzMemberById(userId);

    	if(memberQuery!=null&&memberQuery.getPhone()!=null) {
    		
    	}else {
    		
    		return AjaxResult.error("会员信息不存在，请先注册成为会员");
    	}
    	
    	if(memberQuery.getSfvip().intValue()==0) {
        	return AjaxResult.error("系统已更新，非会员不能查询");
        }
    	
    	if(zyName!=null&&!zyName.trim().equals("")) {
    		
    		if(isSpecialChar(zyName.toString())||sqlValidate(zyName.toString())){
        		AjaxResult.error("参数包含非法字符");
        	}
    	}else {
    		AjaxResult.error("请输入专业名称");
    	}
    	
    	
    	
    	//Map map=new HashMap();
    	
    	//map.put("member", memberQuery);
    	
    	
    	School schoolQuery=new School();
        
        
        if("物理".equals(memberQuery.getSxkm())) {
        	schoolQuery.setMajorType("理工类");
    	}
    	if("历史".equals(memberQuery.getSxkm())) {
    		schoolQuery.setMajorType("文史类");
    	}
    	
    	
    	//如果会员不是少数民族，则不能查询民族班
    	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
    		schoolQuery.setSsmzFlag(0);
    	}
    	
    	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
    		schoolQuery.setGjzxFlag(0);
    	}
    	
    	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
    		schoolQuery.setGxzxFlag(0);
    	}
    	
    	//考生的再选科目
    	schoolQuery.setZxkm(memberQuery.getZxkm());   
    	
    	schoolQuery.setZy(zyName);
    	
                
    	if(pageNum==null||pageNum.intValue()==0) pageNum=1;
        int pageRow=(pageNum-1)*10;
        
        schoolQuery.setPageNum(pageRow);
        
        
        
        
        String schoolCode="";//列表中所有的学校
        
        
        List<School> list = schoolService.selectSchoolListByZy4Page(schoolQuery);
        
        if(list!=null&&list.size()>0) {
        	for(int i=0;i<list.size();i++) {
        		School school=list.get(i);
        		schoolCode=schoolCode+"'"+school.getScode()+"',";
        	}
        }
        
        List<School> returnList =new ArrayList();
        
        if(!schoolCode.equals("")) {

        	schoolCode=schoolCode.substring(0, schoolCode.length()-1);
        	//查询专业组
        	SchoolPlan schoolPlanQuery=new SchoolPlan();
        	schoolPlanQuery.setYear(thisYear);
        	schoolPlanQuery.setSchoolCode(schoolCode);
        	if("物理".equals(memberQuery.getSxkm())) {
        		schoolPlanQuery.setMajorType("理工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		schoolPlanQuery.setMajorType("文史类");
        	}
        	
        	//如果会员不是少数民族，则不能查询民族班
        	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
        		schoolPlanQuery.setSsmzFlag(0);
        	}
        	
        	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
        		schoolPlanQuery.setGjzxFlag(0);
        	}
        	
        	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
        		schoolPlanQuery.setGxzxFlag(0);
        	}
        	
        	//考生的再选科目
        	schoolPlanQuery.setZxkm(memberQuery.getZxkm());
        	schoolPlanQuery.setZy(zyName);
        	
        	
        	List<SchoolPlan> zyzList =schoolPlanService.selectSchoolZyzPlanList(schoolPlanQuery);
        	
        	//List<SchoolPlan> zyzList =schoolPlanService.selectSchoolZyzList(schoolPlanQuery);
        	
        	List<SchoolPlan> plans2023List =schoolPlanService.selectSchoolZyz2023PlanList(schoolPlanQuery);
        	
        	
        	
        	//查询各个专业组近3年的平均分、最低分（当前计算，先以2020,2021,2022这3年的录取数据为模拟数据）
        	SchoolMajorYearAdmission schoolMajorYearAdmission=new SchoolMajorYearAdmission();
        	schoolMajorYearAdmission.setYear(thisYear);
        	schoolMajorYearAdmission.setsCode(schoolCode);
        	if("物理".equals(memberQuery.getSxkm())) {
        		schoolMajorYearAdmission.setMajorType("理工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		schoolMajorYearAdmission.setMajorType("文史类");
        	}
        	
        	//如果会员不是少数民族，则不能查询民族班
        	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
        		schoolMajorYearAdmission.setSsmzFlag(0);
        	}
        	
        	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
        		schoolMajorYearAdmission.setGjzxFlag(0);
        	}
        	
        	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
        		schoolMajorYearAdmission.setGxzxFlag(0);
        	}
        	
        	//考生的再选科目
        	schoolMajorYearAdmission.setZxkm(memberQuery.getZxkm());
        	
        	schoolMajorYearAdmission.setMajor(zyName);
        	
        	
        	//2022,2021,2020 这3年的专业组的录取情况
        	List<SchoolMajorYearAdmission> zyzGradeList=schoolMajorYearAdmissionService.selectSchoolZyzYearAdmissionList(schoolMajorYearAdmission);
        	

        	
        	
        	//查询历年一分一档，用于计算平均分排位和最低分排位
        	GkGradeDoc hisGkGradeDoc=new GkGradeDoc();
        	if("物理".equals(memberQuery.getSxkm())) {
        		hisGkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		hisGkGradeDoc.setGradeClass("史类");
        	}
        	
        	List<GkGradeDoc> hisPwGradeList=gkGradeDocService.selectGkGradeDocList(hisGkGradeDoc);
        	

        	
        	
        	DecimalFormat df = new DecimalFormat("#.00");
        	
        	
        	StringBuffer zyzStr=new StringBuffer();
        	//开始计算专业组投档率
        	for(int y=0;y< zyzList.size();y++) {
        		SchoolPlan zyzPlan=zyzList.get(y);//取出专业组
        		String zyz=zyzPlan.getZyz();
        		zyzStr.append("'").append(zyz).append("',");
        	}
        	
        	
        	String zyzStr2=zyzStr.toString();
        	if(zyzStr2.length()>0) zyzStr2=zyzStr2.substring(0, zyzStr2.length()-1);
        	

			//该专业组下各专业录取概率
			List<SchoolMajorYearAdmission> zyList =new ArrayList();
    		//该专业今年的招生计划（从计划表中取）
			schoolPlanQuery.setZyz(zyzStr2);
			if("物理".equals(memberQuery.getSxkm())) {
        		schoolPlanQuery.setMajorType("理工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		schoolPlanQuery.setMajorType("文史类");
        	}
        	
        	//如果会员不是少数民族，则不能查询民族班
        	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
        		schoolPlanQuery.setSsmzFlag(0);
        	}
        	
        	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
        		schoolPlanQuery.setGjzxFlag(0);
        	}
        	
        	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
        		schoolPlanQuery.setGxzxFlag(0);
        	}
        	
        	schoolPlanQuery.setZy(zyName);
        	
			List<SchoolPlan> zyPlans2023List =schoolPlanService.selectSchoolZyPlan2023ByZyzStrList(schoolPlanQuery);
			
			//该专业当年的招生计划和录取情况（从录取指南中取）
			//查询各个专业近3年的平均分、最低分（当前计算，先以2020,2021,2022这3年的录取数据为模拟数据）
        	SchoolMajorYearAdmission schoolMajorYearAdmissionQuery=new SchoolMajorYearAdmission();
        	schoolMajorYearAdmissionQuery.setYear(thisYear);
        	schoolMajorYearAdmissionQuery.setsCode(schoolCode);
        	if("物理".equals(memberQuery.getSxkm())) {
        		schoolMajorYearAdmissionQuery.setMajorType("理工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		schoolMajorYearAdmissionQuery.setMajorType("文史类");
        	}
        	schoolMajorYearAdmissionQuery.setZyz(zyzStr2);
        	
        	//如果会员不是少数民族，则不能查询民族班
        	if(memberQuery.getSfssmz()!=null&&(memberQuery.getSfssmz()).intValue()==0) {
        		schoolMajorYearAdmission.setSsmzFlag(0);
        	}
        	
        	if(memberQuery.getSfgjzxdfzx()!=null&&(memberQuery.getSfgjzxdfzx()).intValue()==0) {
        		schoolMajorYearAdmission.setGjzxFlag(0);
        	}
        	
        	if(memberQuery.getSfdfzx()!=null&&(memberQuery.getSfdfzx()).intValue()==0) {
        		schoolMajorYearAdmission.setGxzxFlag(0);
        	}
        	
        	//考生的再选科目
        	schoolMajorYearAdmission.setZxkm(memberQuery.getZxkm());
        	
        	schoolMajorYearAdmission.setMajor(zyName);
        	
        	List<SchoolMajorYearAdmission> majorGradeList=schoolMajorYearAdmissionService.selectSchoolMajorZyYearAdmissionListByZyzStr(schoolMajorYearAdmissionQuery);
        	
        	
        	
        	
        	
        	
        	
        	
        	
        	
        	//查询当年考生的排位(先用2023年的一分一档)，拿到2023年该分数的排位，取出2022、2021、2020年的同位分
        	int gxpw=99999999;
        	
        	//广西排位分
        	GkGradeDoc gkGradeDoc=new GkGradeDoc();
        	gkGradeDoc.setGrade(memberQuery.getGxgrade());
        	gkGradeDoc.setYear(gradeLineYear);
        	if("物理".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("史类");
        	}
        	List<GkGradeDoc> gradeList=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);
        	
        	for(int z=0;z<gradeList.size();z++) {
        		GkGradeDoc gradeDoc=gradeList.get(z);
        		if(gradeDoc.getUseIn().equals("广西")) {
        			gxpw=gradeDoc.getSeq();
        		}
        	}
        	
        	//查找近3年的广西同位分
        	gkGradeDoc=new GkGradeDoc();
        	if("物理".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("史类");
        	}
        	gkGradeDoc.setUseIn("广西");
        	gkGradeDoc.setSeq(gxpw);
        	List<GkGradeDoc> gxpwGradeList=gkGradeDocService.selectGkGradeDocListBySeq(gkGradeDoc);
        	List<GkGradeDoc> gxLastPwGradeList=gkGradeDocService.selectGkGradeDocLastRecordList(gkGradeDoc);
        	
        	
        	
        	
        	
        	
        	int qgpw=99999999;
        	
        	
        	int temp_qgjfpw=99999999;//全国加分的排位(认可加分)
        	int temp_qgpw=99999999;//全国加分的排位(不认可加分)
        	
        	
        	//全国认可加分排位分
        	gkGradeDoc=new GkGradeDoc();
        	gkGradeDoc.setGrade(memberQuery.getQggrade());
        	
        	gkGradeDoc.setYear(2024);
        	if("物理".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("史类");
        	}
        	gkGradeDoc.setUseIn("全国");
        	List<GkGradeDoc> gradeList2=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);
        	
        	
        	for(int z=0;z<gradeList2.size();z++) {
        		GkGradeDoc gradeDoc=gradeList2.get(z);
        		
        		if(gradeDoc.getUseIn().equals("全国")) {
        			temp_qgjfpw=gradeDoc.getSeq();//认可加分的排位分
        		}
        	}
        	
        	//全国不认可加分排位分
        	gkGradeDoc=new GkGradeDoc();
        	gkGradeDoc.setGrade(memberQuery.getGrade());
        	
        	gkGradeDoc.setYear(2024);
        	if("物理".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("史类");
        	}
        	gkGradeDoc.setUseIn("全国");
        	List<GkGradeDoc> gradeList3=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);
        	
        	for(int z=0;z<gradeList3.size();z++) {
        		GkGradeDoc gradeDoc=gradeList3.get(z);
        		
        		if(gradeDoc.getUseIn().equals("全国")) {
        			temp_qgpw=gradeDoc.getSeq();//认可加分的排位分
        		}
        	}
        	
        	
        	
        	
        	//查找进3年的全国同位分（认可加分的排位）
        	gkGradeDoc=new GkGradeDoc();
        	if("物理".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("工类");
        	}
        	if("历史".equals(memberQuery.getSxkm())) {
        		gkGradeDoc.setGradeClass("史类");
        	}
        	gkGradeDoc.setUseIn("全国");
        	gkGradeDoc.setSeq(temp_qgjfpw);
        	List<GkGradeDoc> qgpwGradeList=gkGradeDocService.selectGkGradeDocListBySeq(gkGradeDoc);
        	
        	
        	//不认可加分的排位
        	gkGradeDoc.setSeq(temp_qgpw);
        	List<GkGradeDoc> qgpwNoAddGradeList=gkGradeDocService.selectGkGradeDocListBySeq(gkGradeDoc);
        	
        	
        	
        	List<GkGradeDoc> qgLastGradeList=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);
        	
        	
        	
        	
        	
        	
        	
        	
        	//开始计算专业组投档率
        	for(int y=0;y< zyzList.size();y++) {
        		SchoolPlan zyzPlan=zyzList.get(y);//取出专业组
        		
        		String provinceName="";
        		
        		School school=null;
        		for(int z=0;z<list.size();z++) {
        			School mySchool=list.get(z);
        			if(mySchool.getScode().equals(zyzPlan.getSchoolCode())) {
        				school=mySchool;
        				provinceName=school.getProvinceName();
        				break;
        			}
        		}
        		
        		
        		
        		
        		boolean qgjfFlag=true;//是否认可全国加分
            	if(school.getRemark()!=null) {
            		if(school.getRemark().indexOf("不认可加分")>-1) {//该学校不认可加分，则全国分只取高考分
            			qgjfFlag=false;
            		}
            	}
        		
        		

            	//查找近3年的广西排位
            	int gxj2022=0;
            	int gxj2021=0;
            	int gxj2020=0;
            	for(int z=0;z<gxpwGradeList.size();z++) {
            		GkGradeDoc gxGradeDoc=gxpwGradeList.get(z);
            		if(gxGradeDoc.getYear().intValue()==yearNew1) {
            			gxj2022=gxGradeDoc.getGrade();
            		}
            		if(gxGradeDoc.getYear().intValue()==yearNew2) {
            			gxj2021=gxGradeDoc.getGrade();
            		}
            		if(gxGradeDoc.getYear().intValue()==yearNew3) {
            			gxj2020=gxGradeDoc.getGrade();
            		}
            	}
            	
            	if(gxj2022==0) {
            		for(int z=0;z<gxLastPwGradeList.size();z++) {
                		GkGradeDoc gxGradeDoc=gxLastPwGradeList.get(z);
                		if(gxGradeDoc.getYear().intValue()==yearNew1) {
                			gxj2022=gxGradeDoc.getGrade();
                		}
            		}
            	}
            	if(gxj2021==0) {
            		for(int z=0;z<gxLastPwGradeList.size();z++) {
                		GkGradeDoc gxGradeDoc=gxLastPwGradeList.get(z);
                		if(gxGradeDoc.getYear().intValue()==yearNew2) {
                			gxj2021=gxGradeDoc.getGrade();
                		}
            		}
            	}
            	if(gxj2020==0) {
            		for(int z=0;z<gxLastPwGradeList.size();z++) {
                		GkGradeDoc gxGradeDoc=gxLastPwGradeList.get(z);
                		if(gxGradeDoc.getYear().intValue()==yearNew3) {
                			gxj2020=gxGradeDoc.getGrade();
                		}
            		}
            	}
            	
            	
            	
            	int qgj2022=0;//近3年全国不加分的排位分
            	int qgj2021=0;
            	int qgj2020=0;
            	if(qgjfFlag) {//认可加分
            		qgpw=temp_qgjfpw;
            		for(int z=0;z<qgpwGradeList.size();z++) {
                		GkGradeDoc gxGradeDoc=qgpwGradeList.get(z);
                		if(gxGradeDoc.getYear().intValue()==yearNew1) {
                			qgj2022=gxGradeDoc.getGrade();
                		}
                		if(gxGradeDoc.getYear().intValue()==yearNew2) {
                			qgj2021=gxGradeDoc.getGrade();
                		}
                		if(gxGradeDoc.getYear().intValue()==yearNew3) {
                			qgj2020=gxGradeDoc.getGrade();
                		}
                	}
            	}else {//不认可加分
            		qgpw=temp_qgpw;
            		for(int z=0;z<qgpwNoAddGradeList.size();z++) {
                		GkGradeDoc gxGradeDoc=qgpwNoAddGradeList.get(z);
                		if(gxGradeDoc.getYear().intValue()==yearNew1) {
                			qgj2022=gxGradeDoc.getGrade();
                		}
                		if(gxGradeDoc.getYear().intValue()==yearNew2) {
                			qgj2021=gxGradeDoc.getGrade();
                		}
                		if(gxGradeDoc.getYear().intValue()==yearNew3) {
                			qgj2020=gxGradeDoc.getGrade();
                		}
                	}
            	}
        		if(qgj2022==0) {
        			for(int z=0;z<qgLastGradeList.size();z++) {
                		GkGradeDoc gxGradeDoc=qgLastGradeList.get(z);
                		if(gxGradeDoc.getYear().intValue()==yearNew1) {
                			qgj2022=gxGradeDoc.getGrade();
                		}
        			}
        		}
        		if(qgj2021==0) {
        			for(int z=0;z<qgLastGradeList.size();z++) {
                		GkGradeDoc gxGradeDoc=qgLastGradeList.get(z);
                		if(gxGradeDoc.getYear().intValue()==yearNew2) {
                			qgj2021=gxGradeDoc.getGrade();
                		}
        			}
        		}
        		if(qgj2020==0) {
        			for(int z=0;z<qgLastGradeList.size();z++) {
                		GkGradeDoc gxGradeDoc=qgLastGradeList.get(z);
                		if(gxGradeDoc.getYear().intValue()==yearNew3) {
                			qgj2020=gxGradeDoc.getGrade();
                		}
        			}
        		}
        		
        		
        		String zyz=zyzPlan.getZyz();
				
				
				int avgGrade2022=0;
				int minGrade2022=0;
				int avgGrade2021=0;
				int minGrade2021=0;
				int avgGrade2020=0;
				int minGrade2020=0;
				
				//历史招生数量，从指南取
				int plan2022=0;
				int submit2022=0;
				int adm2022=0;
				int plan2021=0;
				int submit2021=0;
				int adm2021=0;
				int plan2020=0;
				int submit2020=0;
				int adm2020=0;
				
				//当年招生数量，从招生计划取
				int plan2023=0;
				
				School schoolRecord2022=new School();
				schoolRecord2022.setProvinceName(provinceName);
				schoolRecord2022.setSname(school.getSname());
				schoolRecord2022.setScode(school.getScode());
				schoolRecord2022.setZyz(zyz);
				schoolRecord2022.setZxkm(zyzPlan.getKm2());
				schoolRecord2022.setYear(yearNew1);
				schoolRecord2022.setSranking(school.getSranking());
				
				if(provinceName.equals("广西")) {
					schoolRecord2022.setSeqGrade(new Integer(gxj2022).toString());
					schoolRecord2022.setSeq(new Integer(gxpw).toString());
				}else {
					schoolRecord2022.setSeqGrade(new Integer(qgj2022).toString());
					schoolRecord2022.setSeq(new Integer(qgpw).toString());
				}
				
				
				//设置分数线
				if("物理".equals(memberQuery.getSxkm())) {
					schoolRecord2022.setGradeLine(new Integer(gradeLineLg2022).toString());
				}
				if("历史".equals(memberQuery.getSxkm())) {
					schoolRecord2022.setGradeLine(new Integer(gradeLineWs2022).toString());
				}
				
				SchoolMajorYearAdmission admission2022=null;
				SchoolMajorYearAdmission admission2021=null;
				SchoolMajorYearAdmission admission2020=null;
				for(int j=0;j<zyzGradeList.size();j++) {
					SchoolMajorYearAdmission admission=zyzGradeList.get(j);
					String zyzAdmin=admission.getZyz();
					
					if(zyz.equals(zyzAdmin)&&admission.getsCode().equals(zyzPlan.getSchoolCode())) {//同一个学校的专业组        						
						if(admission.getYear()==yearNew1) {
							admission2022=admission;
						}
						if(admission.getYear()==yearNew2) {
							admission2021=admission;
						}
						if(admission.getYear()==yearNew3) {
							admission2020=admission;
						}
					}
				}
				if(admission2022!=null&&admission2022.getAvgGrade()!=null) {
					schoolRecord2022.setAvgGrade(admission2022.getAvgGrade().toString());
					schoolRecord2022.setMinGrade(admission2022.getLowGrade().toString());
					avgGrade2022=admission2022.getAvgGrade();
					minGrade2022=admission2022.getLowGrade();
					
					
					
					
					//计算平均分排位，最低分排位
					int avgGrade2022Seq=99999999;
					int lastSeq=1;
					for(int m=0;m<hisPwGradeList.size();m++) {
						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
						if(hisGradeDoc.getYear().intValue()==yearNew1) {
							
							
							int myGrade=hisGradeDoc.getGrade();
							
							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
								if(hisGradeDoc.getUseIn().equals("广西")) {
									int fencha=myGrade-avgGrade2022;
									if(fencha==0) {
										avgGrade2022Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										avgGrade2022Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
									
								}
							}else {
								if(hisGradeDoc.getUseIn().equals("全国")) {
									int fencha=myGrade-avgGrade2022;
									if(fencha==0) {
										avgGrade2022Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										avgGrade2022Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
								}
							}
							
						}
					}
					
					schoolRecord2022.setAvgGradeSeq(new Integer(avgGrade2022Seq).toString());
					
					
					int minGrade2022Seq=99999999;
					lastSeq=1;
					for(int m=0;m<hisPwGradeList.size();m++) {
						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
						if(hisGradeDoc.getYear().intValue()==yearNew1) {
							
							
							int myGrade=hisGradeDoc.getGrade();
							
							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
								if(hisGradeDoc.getUseIn().equals("广西")) {
									int fencha=myGrade-minGrade2022;
									if(fencha==0) {
										minGrade2022Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										minGrade2022Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
									
								}
							}else {
								if(hisGradeDoc.getUseIn().equals("全国")) {
									int fencha=myGrade-minGrade2022;
									if(fencha==0) {
										minGrade2022Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										minGrade2022Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
								}
							}
							
						}
					}

					schoolRecord2022.setMinGradeSeq(new Integer(minGrade2022Seq).toString());
					
				}else {
					schoolRecord2022.setAvgGrade("-");
					schoolRecord2022.setMinGrade("-");
					schoolRecord2022.setAvgGradeSeq("-");
					schoolRecord2022.setMinGradeSeq("-");
				}
				
				if(admission2022!=null) {
					plan2022=admission2022.getPlan();
					
					if(admission2022.getSubmit()!=null) {
						submit2022=admission2022.getSubmit();
					}
					adm2022=admission2022.getAdmission();
					schoolRecord2022.setPlanSubmitAdmission(plan2022+"-"+adm2022);
					}
				
				
				for(int j=0;j<plans2023List.size();j++) {
					SchoolPlan schoolPlan2023=plans2023List.get(j);
					if(zyz.equals(schoolPlan2023.getZyz())&&zyzPlan.getSchoolCode().equals(schoolPlan2023.getSchoolCode())) {//同一个学校的专业组        	
						plan2023=schoolPlan2023.getMajorPlan();
					}
				}
        		
				School schoolRecord2021=new School();
				schoolRecord2021.setProvinceName(provinceName);
				schoolRecord2021.setSname(school.getSname());
				schoolRecord2021.setScode(school.getScode());
				schoolRecord2021.setZyz(zyz);
				schoolRecord2021.setZxkm(zyzPlan.getKm2());
				schoolRecord2021.setYear(yearNew2);
				schoolRecord2021.setSranking(school.getSranking());
				
				if(provinceName.equals("广西")) {
					schoolRecord2021.setSeqGrade(new Integer(gxj2021).toString());
					schoolRecord2021.setSeq(new Integer(gxpw).toString());
				}else {
					schoolRecord2021.setSeqGrade(new Integer(qgj2021).toString());
					schoolRecord2021.setSeq(new Integer(qgpw).toString());
				}
				
				
				//设置分数线
				if("物理".equals(memberQuery.getSxkm())) {
					schoolRecord2021.setGradeLine(new Integer(gradeLineLg2021).toString());
				}
				if("历史".equals(memberQuery.getSxkm())) {
					schoolRecord2021.setGradeLine(new Integer(gradeLineWs2021).toString());
				}
				
				if(admission2021!=null&&admission2021.getAvgGrade()!=null) {
					schoolRecord2021.setAvgGrade(admission2021.getAvgGrade().toString());
					schoolRecord2021.setMinGrade(admission2021.getLowGrade().toString());
					avgGrade2021=admission2021.getAvgGrade();
					minGrade2021=admission2021.getLowGrade();

					
					//计算平均分排位，最低分排位
					int avgGrade2021Seq=99999999;
					int lastSeq=1;
					for(int m=0;m<hisPwGradeList.size();m++) {
						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
						if(hisGradeDoc.getYear().intValue()==yearNew2) {
							
							
							int myGrade=hisGradeDoc.getGrade();
							
							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
								if(hisGradeDoc.getUseIn().equals("广西")) {
									int fencha=myGrade-avgGrade2021;
									if(fencha==0) {
										avgGrade2021Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										avgGrade2021Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
									
								}
							}else {
								if(hisGradeDoc.getUseIn().equals("全国")) {
									int fencha=myGrade-avgGrade2021;
									if(fencha==0) {
										avgGrade2021Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										avgGrade2021Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
								}
							}
							
						}
					}
					
					schoolRecord2021.setAvgGradeSeq(new Integer(avgGrade2021Seq).toString());
					
					
					int minGrade2021Seq=99999999;
					lastSeq=1;
					for(int m=0;m<hisPwGradeList.size();m++) {
						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
						if(hisGradeDoc.getYear().intValue()==yearNew2) {
							
							
							int myGrade=hisGradeDoc.getGrade();
							
							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
								if(hisGradeDoc.getUseIn().equals("广西")) {
									int fencha=myGrade-minGrade2021;
									if(fencha==0) {
										minGrade2021Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										minGrade2021Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
									
								}
							}else {
								if(hisGradeDoc.getUseIn().equals("全国")) {
									int fencha=myGrade-minGrade2021;
									if(fencha==0) {
										minGrade2021Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										minGrade2021Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
								}
							}
							
						}
					}
					
					schoolRecord2021.setMinGradeSeq(new Integer(minGrade2021Seq).toString());
					
					
					
					
					
					
				}else {
					schoolRecord2021.setAvgGrade("-");
					schoolRecord2021.setMinGrade("-");
					schoolRecord2021.setAvgGradeSeq("-");
					schoolRecord2021.setMinGradeSeq("-");
				}
				if(admission2021!=null) {
					plan2021=admission2021.getPlan();
					if(admission2021.getSubmit()!=null) {
						submit2021=admission2021.getSubmit();
					}
					adm2021=admission2021.getAdmission();
					schoolRecord2021.setPlanSubmitAdmission(plan2021+"-"+adm2021);
				}
				
				
				School schoolRecord2020=new School();
				schoolRecord2020.setProvinceName(provinceName);
				schoolRecord2020.setSname(school.getSname());
				schoolRecord2020.setScode(school.getScode());
				schoolRecord2020.setZyz(zyz);
				schoolRecord2020.setZxkm(zyzPlan.getKm2());
				schoolRecord2020.setYear(yearNew3);
				schoolRecord2020.setSranking(school.getSranking());
				
				if(provinceName.equals("广西")) {
					schoolRecord2020.setSeqGrade(new Integer(gxj2020).toString());
					schoolRecord2020.setSeq(new Integer(gxpw).toString());
				}else {
					schoolRecord2020.setSeqGrade(new Integer(qgj2020).toString());
					schoolRecord2020.setSeq(new Integer(qgpw).toString());
				}
				
				
				//设置分数线
				if("物理".equals(memberQuery.getSxkm())) {
					schoolRecord2020.setGradeLine(new Integer(gradeLineLg2020).toString());
				}
				if("历史".equals(memberQuery.getSxkm())) {
					schoolRecord2020.setGradeLine(new Integer(gradeLineWs2020).toString());
				}
				
				if(admission2020!=null&&admission2020.getAvgGrade()!=null) {
					schoolRecord2020.setAvgGrade(admission2020.getAvgGrade().toString());
					schoolRecord2020.setMinGrade(admission2020.getLowGrade().toString());
					avgGrade2020=admission2020.getAvgGrade();
					minGrade2020=admission2020.getLowGrade();        		
					
					
					
					
					//计算平均分排位，最低分排位
					int avgGrade2020Seq=99999999;
					int lastSeq=1;
					for(int m=0;m<hisPwGradeList.size();m++) {
						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
						if(hisGradeDoc.getYear().intValue()==yearNew3) {
							
							
							int myGrade=hisGradeDoc.getGrade();
							
							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
								if(hisGradeDoc.getUseIn().equals("广西")) {
									int fencha=myGrade-avgGrade2020;
									if(fencha==0) {
										avgGrade2020Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										avgGrade2020Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
									
								}
							}else {
								if(hisGradeDoc.getUseIn().equals("全国")) {
									int fencha=myGrade-avgGrade2020;
									if(fencha==0) {
										avgGrade2020Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										avgGrade2020Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
								}
							}
							
						}
					}
					
					schoolRecord2020.setAvgGradeSeq(new Integer(avgGrade2020Seq).toString());
					
					
					int minGrade2020Seq=99999999;
					lastSeq=1;
					for(int m=0;m<hisPwGradeList.size();m++) {
						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
						if(hisGradeDoc.getYear().intValue()==yearNew3) {
							
							
							int myGrade=hisGradeDoc.getGrade();
							
							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
								if(hisGradeDoc.getUseIn().equals("广西")) {
									int fencha=myGrade-minGrade2020;
									if(fencha==0) {
										minGrade2020Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										minGrade2020Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
									
								}
							}else {
								if(hisGradeDoc.getUseIn().equals("全国")) {
									int fencha=myGrade-minGrade2020;
									if(fencha==0) {
										minGrade2020Seq=hisGradeDoc.getSeq();
										break;
									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
										minGrade2020Seq=lastSeq;
										break;
									}
									
									lastSeq=hisGradeDoc.getSeq();
								}
							}
							
						}
					}
					
					schoolRecord2020.setMinGradeSeq(new Integer(minGrade2020Seq).toString());
					
					
					
					
					
					
					
				}else {
					schoolRecord2020.setAvgGrade("-");
					schoolRecord2020.setMinGrade("-");
					schoolRecord2020.setAvgGradeSeq("-");
					schoolRecord2020.setMinGradeSeq("-");
				}
				if(admission2020!=null) {
					plan2020=admission2020.getPlan();
					if(admission2020.getSubmit()!=null) {
						submit2020=admission2020.getSubmit();
					}
					adm2020=admission2020.getAdmission();
					schoolRecord2020.setPlanSubmitAdmission(plan2020+"-"+adm2020);
					}
				
				//开始计算投档概率
				
				/****
				 * 专科的录取概率计算
				 * 2024年的分数为a，2023年的院校录取最低分为b,a-b除2—再加50%等于院校专业组投档概率。2024年的分数为c，2023年的专业录取最低分为d,c-d除2—再加50%等于院校专业录取概率。
				 */
				if(provinceName.equals("广西")) {//广西学校
					int userGrade=memberQuery.getGxgrade();
					double rate=(userGrade-minGrade2022)/2+50;
					if(rate>=100) rate=99.99;
					if(rate<1) rate=1;
					schoolRecord2020.setSubmitRate(df.format(rate));
					schoolRecord2021.setSubmitRate(df.format(rate));
					schoolRecord2022.setSubmitRate(df.format(rate));
				}else {//全国学校
					if(qgjfFlag) {//认可加分
						int userGrade=memberQuery.getQggrade();
    					double rate=(userGrade-minGrade2022)/2+50;
    					if(rate>=100) rate=99.99;
						if(rate<1) rate=1;
						schoolRecord2020.setSubmitRate(df.format(rate));
						schoolRecord2021.setSubmitRate(df.format(rate));
						schoolRecord2022.setSubmitRate(df.format(rate));
					}else {
						int userGrade=memberQuery.getGrade();
    					double rate=(userGrade-minGrade2022)/2+50;
    					if(rate>=100) rate=99.99;
						if(rate<1) rate=1;
						schoolRecord2020.setSubmitRate(df.format(rate));
						schoolRecord2021.setSubmitRate(df.format(rate));
						schoolRecord2022.setSubmitRate(df.format(rate));
					}
					
				}
				
				if(schoolRecord2022.getSubmitRate()==null) {
					schoolRecord2022.setSubmitRate("-");
				}
				if(schoolRecord2022.getPlanSubmitAdmission()==null) {
					schoolRecord2022.setPlanSubmitAdmission("-");
				}
				
				
				if(schoolRecord2022.getAvgGradeSeq()==null||schoolRecord2022.getAvgGradeSeq().equals("99999999")) {
					schoolRecord2022.setAvgGradeSeq("-");
				}
				
				if(schoolRecord2022.getMinGradeSeq()==null||schoolRecord2022.getMinGradeSeq().equals("99999999")) {
					schoolRecord2022.setMinGradeSeq("-");
				}
				
				if(schoolRecord2021.getSubmitRate()==null) {
					schoolRecord2021.setSubmitRate("-");
					
				}
				if(schoolRecord2021.getPlanSubmitAdmission()==null) {
					schoolRecord2021.setPlanSubmitAdmission("-");
				}
				
				if(schoolRecord2021.getAvgGradeSeq()==null||schoolRecord2021.getAvgGradeSeq().equals("99999999")) {
					schoolRecord2021.setAvgGradeSeq("-");
				}
				
				if(schoolRecord2021.getMinGradeSeq()==null||schoolRecord2021.getMinGradeSeq().equals("99999999")) {
					schoolRecord2021.setMinGradeSeq("-");
				}
				
				
				if(schoolRecord2020.getSubmitRate()==null) {
					schoolRecord2020.setSubmitRate("-");
				}
				if(schoolRecord2020.getPlanSubmitAdmission()==null) {
					schoolRecord2020.setPlanSubmitAdmission("-");
				}
				
				if(schoolRecord2020.getAvgGradeSeq()==null||schoolRecord2020.getAvgGradeSeq().equals("99999999")) {
					schoolRecord2020.setAvgGradeSeq("-");
				}
				
				if(schoolRecord2020.getMinGradeSeq()==null||schoolRecord2020.getMinGradeSeq().equals("99999999")) {
					schoolRecord2020.setMinGradeSeq("-");
				}
				
				
				
				
				
				//returnList.add(schoolRecord2022);
				//returnList.add(schoolRecord2021);
				//returnList.add(schoolRecord2020);
        		
        		
				//map.put("returnList", returnList);
        		
				
				
				/*******************************************
				 * 
				 * 计算该专业组下的各专业的录取概率
				 * 
				 */
				
        		
	        	
	        	
	        	for(int k=0;k<zyPlans2023List.size();k++) {
	        		SchoolPlan schoolPlan=zyPlans2023List.get(k);
	        		
	        		
	        		if(schoolPlan.getZyz().equals(zyzPlan.getZyz())&&schoolPlan.getSchoolCode().equals(zyzPlan.getSchoolCode())) {
	        			
	        			School returnSchool=new School();
		        		returnSchool.setProvinceName(provinceName);
		        		returnSchool.setScode(schoolRecord2022.getScode());
		        		returnSchool.setSname(schoolRecord2022.getSname());
		        		returnSchool.setZyz(schoolRecord2022.getZyz());
		        		returnSchool.setZxkm(schoolRecord2022.getZxkm());
		        		returnSchool.setSranking(schoolRecord2022.getSranking());
		        		returnSchool.setMajorName(schoolPlan.getMajorName());
		        		returnSchool.setThisYearMajorPlan(schoolPlan.getMajorPlan());
		        		returnSchool.setSubmitRate(schoolRecord2022.getSubmitRate());//专业组投档概率
		        		returnSchool.setZy(schoolPlan.getMajorCode());
	        		
	        		
		        		int zyavgGrade2022=0;
	    				int zyminGrade2022=0;
	    				int zyavgGrade2021=0;
	    				int zyminGrade2021=0;
	    				int zyavgGrade2020=0;
	    				int zyminGrade2020=0;
	    				
	    				//历史招生数量，从指南取
	    				int zyplan2022=0;
	    				int zysubmit2022=0;
	    				int zyadm2022=0;
	    				int zyplan2021=0;
	    				int zysubmit2021=0;
	    				int zyadm2021=0;
	    				int zyplan2020=0;
	    				int zysubmit2020=0;
	    				int zyadm2020=0;
	    				
	    				//当年招生数量，从招生计划取
	    				int zyplan2023=schoolPlan.getMajorPlan();
		        		
		        		SchoolMajorYearAdmission schoolMajorYearAdmission2022=new SchoolMajorYearAdmission();
		        		schoolMajorYearAdmission2022.setYear(yearNew1);
		        		schoolMajorYearAdmission2022.setMajorCode(schoolPlan.getMajorCode());
		        		schoolMajorYearAdmission2022.setMajorSeq(schoolPlan.getMajorSeq());
		        		schoolMajorYearAdmission2022.setMajor(schoolPlan.getMajorName());
		        		schoolMajorYearAdmission2022.setThisYearMajorPlan(schoolPlan.getMajorPlan());
		        		schoolMajorYearAdmission2022.setZyz(schoolPlan.getZyz());
		        		schoolMajorYearAdmission2022.setsCode(schoolPlan.getSchoolCode());
		        		
		        		
		        		if(provinceName.equals("广西")) {
		        			schoolMajorYearAdmission2022.setSeqGrade(new Integer(gxj2022).toString());
		        			schoolMajorYearAdmission2022.setSeq(new Integer(gxpw).toString());
	    				}else {
	    					schoolMajorYearAdmission2022.setSeqGrade(new Integer(qgj2022).toString());
	    					schoolMajorYearAdmission2022.setSeq(new Integer(qgpw).toString());
	    				}
	    				
	    				
	    				//设置分数线
	    				if("物理".equals(memberQuery.getSxkm())) {
	    					schoolMajorYearAdmission2022.setGradeLine(new Integer(gradeLineLg2022).toString());
	    				}
	    				if("历史".equals(memberQuery.getSxkm())) {
	    					schoolMajorYearAdmission2022.setGradeLine(new Integer(gradeLineWs2022).toString());
	    				}
	    				
	    				SchoolMajorYearAdmission zyadmission2022=null;
	    				SchoolMajorYearAdmission zyadmission2021=null;
	    				SchoolMajorYearAdmission zyadmission2020=null;
	    				for(int j=0;j<majorGradeList.size();j++) {
	    					SchoolMajorYearAdmission admission=majorGradeList.get(j);
	    					
	    					
	    					if(schoolPlan.getMajorCode().equals(admission.getMajorCode())&&schoolPlan.getSchoolCode().equals(admission.getsCode())) {//同一个专业        						
	    						if(admission.getYear()==yearNew1) {
	    							zyadmission2022=admission;
	    						}
	    						if(admission.getYear()==yearNew2) {
	    							zyadmission2021=admission;
	    						}
	    						if(admission.getYear()==yearNew3) {
	    							zyadmission2020=admission;
	    						}
	    					}
	    				}
	    				
	    				
	    				if(zyadmission2022!=null&&zyadmission2022.getAvgGrade()!=null) {
	    					schoolMajorYearAdmission2022.setAvgGradeStr(zyadmission2022.getAvgGrade().toString());
	    					schoolMajorYearAdmission2022.setMinGradeStr(zyadmission2022.getLowGrade().toString());
                            schoolMajorYearAdmission2022.setAdmission(zyadmission2022.getAdmission());
	    					zyavgGrade2022=zyadmission2022.getAvgGrade();
	    					zyminGrade2022=zyadmission2022.getLowGrade();
	    					
	    					
	    					//计算平均分排位，最低分排位
	    					int avgGrade2022Seq=99999999;
	    					int lastSeq=1;
	    					for(int m=0;m<hisPwGradeList.size();m++) {
	    						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
	    						if(hisGradeDoc.getYear().intValue()==yearNew1) {
	    							
	    							
	    							int myGrade=hisGradeDoc.getGrade();
	    							
	    							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
	    								if(hisGradeDoc.getUseIn().equals("广西")) {
	    									int fencha=myGrade-zyavgGrade2022;
	    									if(fencha==0) {
	    										avgGrade2022Seq=hisGradeDoc.getSeq();
	    										break;
	    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
	    										avgGrade2022Seq=lastSeq;
	    										break;
	    									}
	    									
	    									lastSeq=hisGradeDoc.getSeq();
	    									
	    								}
	    							}else {
	    								if(hisGradeDoc.getUseIn().equals("全国")) {
	    									int fencha=myGrade-zyavgGrade2022;
	    									if(fencha==0) {
	    										avgGrade2022Seq=hisGradeDoc.getSeq();
	    										break;
	    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
	    										avgGrade2022Seq=lastSeq;
	    										break;
	    									}
	    									
	    									lastSeq=hisGradeDoc.getSeq();
	    								}
	    							}
	    							
	    						}
	    					}
	    					
	    					schoolMajorYearAdmission2022.setAvgGradeSeq(new Integer(avgGrade2022Seq).toString());
	    					
	    					
	    					int minGrade2022Seq=99999999;
	    					lastSeq=1;
	    					for(int m=0;m<hisPwGradeList.size();m++) {
	    						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
	    						if(hisGradeDoc.getYear().intValue()==yearNew1) {
	    							
	    							
	    							int myGrade=hisGradeDoc.getGrade();
	    							
	    							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
	    								if(hisGradeDoc.getUseIn().equals("广西")) {
	    									int fencha=myGrade-zyminGrade2022;
	    									if(fencha==0) {
	    										minGrade2022Seq=hisGradeDoc.getSeq();
	    										break;
	    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
	    										minGrade2022Seq=lastSeq;
	    										break;
	    									}
	    									
	    									lastSeq=hisGradeDoc.getSeq();
	    									
	    								}
	    							}else {
	    								if(hisGradeDoc.getUseIn().equals("全国")) {
	    									int fencha=myGrade-zyminGrade2022;
	    									if(fencha==0) {
	    										minGrade2022Seq=hisGradeDoc.getSeq();
	    										break;
	    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
	    										minGrade2022Seq=lastSeq;
	    										break;
	    									}
	    									
	    									lastSeq=hisGradeDoc.getSeq();
	    								}
	    							}
	    							
	    						}
	    					}
	    					
	    					schoolMajorYearAdmission2022.setMinGradeSeq(new Integer(minGrade2022Seq).toString());
	    					
	    					
	    				}else {
	    					schoolMajorYearAdmission2022.setAvgGradeStr("-");
	    					schoolMajorYearAdmission2022.setMinGradeStr("-");
	    					schoolMajorYearAdmission2022.setAvgGradeSeq("-");
	    					schoolMajorYearAdmission2022.setMinGradeSeq("-");
	    				}
	    				
	    				if(zyadmission2022!=null) {
		    				zyplan2022=zyadmission2022.getPlan();
							
							schoolMajorYearAdmission2022.setMajorPlan(zyplan2022);
							
							if(zyadmission2022.getSubmit()!=null) {
								zysubmit2022=zyadmission2022.getSubmit();
							}
							zyadm2022=zyadmission2022.getAdmission();
							schoolMajorYearAdmission2022.setPlanSubmitAdmission(plan2022+"-"+adm2022);
	    				}
	    				
	
	    				SchoolMajorYearAdmission schoolMajorYearAdmission2021=new SchoolMajorYearAdmission();
		        		schoolMajorYearAdmission2021.setYear(yearNew2);
		        		schoolMajorYearAdmission2021.setMajorCode(schoolPlan.getMajorCode());
		        		schoolMajorYearAdmission2021.setMajorSeq(schoolPlan.getMajorSeq());
		        		schoolMajorYearAdmission2021.setMajor(schoolPlan.getMajorName());
		        		schoolMajorYearAdmission2021.setThisYearMajorPlan(schoolPlan.getMajorPlan());
		        		schoolMajorYearAdmission2021.setsCode(schoolPlan.getSchoolCode());
		        		schoolMajorYearAdmission2021.setZyz(schoolPlan.getZyz());
		        		
		        		
		        		if(provinceName.equals("广西")) {
		        			schoolMajorYearAdmission2021.setSeqGrade(new Integer(gxj2021).toString());
		        			schoolMajorYearAdmission2021.setSeq(new Integer(gxpw).toString());
	    				}else {
	    					schoolMajorYearAdmission2021.setSeqGrade(new Integer(qgj2021).toString());
	    					schoolMajorYearAdmission2021.setSeq(new Integer(qgpw).toString());
	    				}
	    				
	    				
	    				//设置分数线
	    				if("物理".equals(memberQuery.getSxkm())) {
	    					schoolMajorYearAdmission2021.setGradeLine(new Integer(gradeLineLg2021).toString());
	    				}
	    				if("历史".equals(memberQuery.getSxkm())) {
	    					schoolMajorYearAdmission2021.setGradeLine(new Integer(gradeLineWs2021).toString());
	    				}
	    				
	    				
	    				
	    				
	    				if(zyadmission2021!=null&&zyadmission2021.getAvgGrade()!=null) {
	    					schoolMajorYearAdmission2021.setAvgGradeStr(zyadmission2021.getAvgGrade().toString());
	    					schoolMajorYearAdmission2021.setMinGradeStr(zyadmission2021.getLowGrade().toString());
                            schoolMajorYearAdmission2021.setAdmission(zyadmission2021.getAdmission());
	    					zyavgGrade2021=zyadmission2021.getAvgGrade();
	    					zyminGrade2021=zyadmission2021.getLowGrade();
	    					
	    					
	    					//计算平均分排位，最低分排位
	    					int avgGrade2021Seq=99999999;
	    					int lastSeq=1;
	    					for(int m=0;m<hisPwGradeList.size();m++) {
	    						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
	    						if(hisGradeDoc.getYear().intValue()==yearNew2) {
	    							
	    							
	    							int myGrade=hisGradeDoc.getGrade();
	    							
	    							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
	    								if(hisGradeDoc.getUseIn().equals("广西")) {
	    									int fencha=myGrade-zyavgGrade2021;
	    									if(fencha==0) {
	    										avgGrade2021Seq=hisGradeDoc.getSeq();
	    										break;
	    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
	    										avgGrade2021Seq=lastSeq;
	    										break;
	    									}
	    									
	    									lastSeq=hisGradeDoc.getSeq();
	    									
	    								}
	    							}else {
	    								if(hisGradeDoc.getUseIn().equals("全国")) {
	    									int fencha=myGrade-zyavgGrade2021;
	    									if(fencha==0) {
	    										avgGrade2021Seq=hisGradeDoc.getSeq();
	    										break;
	    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
	    										avgGrade2021Seq=lastSeq;
	    										break;
	    									}
	    									
	    									lastSeq=hisGradeDoc.getSeq();
	    								}
	    							}
	    							
	    						}
	    					}
	    					
	    					schoolMajorYearAdmission2021.setAvgGradeSeq(new Integer(avgGrade2021Seq).toString());
	    					
	    					
	    					int minGrade2021Seq=99999999;
	    					lastSeq=1;
	    					for(int m=0;m<hisPwGradeList.size();m++) {
	    						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
	    						if(hisGradeDoc.getYear().intValue()==yearNew2) {
	    							
	    							
	    							int myGrade=hisGradeDoc.getGrade();
	    							
	    							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
	    								if(hisGradeDoc.getUseIn().equals("广西")) {
	    									int fencha=myGrade-zyminGrade2021;
	    									if(fencha==0) {
	    										minGrade2021Seq=hisGradeDoc.getSeq();
	    										break;
	    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
	    										minGrade2021Seq=lastSeq;
	    										break;
	    									}
	    									
	    									lastSeq=hisGradeDoc.getSeq();
	    									
	    								}
	    							}else {
	    								if(hisGradeDoc.getUseIn().equals("全国")) {
	    									int fencha=myGrade-zyminGrade2021;
	    									if(fencha==0) {
	    										minGrade2021Seq=hisGradeDoc.getSeq();
	    										break;
	    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
	    										minGrade2021Seq=lastSeq;
	    										break;
	    									}
	    									
	    									lastSeq=hisGradeDoc.getSeq();
	    								}
	    							}
	    							
	    						}
	    					}
	    					
	    					schoolMajorYearAdmission2021.setMinGradeSeq(new Integer(minGrade2021Seq).toString());
	    					
	    					
	    					
	    					
	    				}else {
	    					schoolMajorYearAdmission2021.setAvgGradeStr("-");
	    					schoolMajorYearAdmission2021.setMinGradeStr("-");
	    					schoolMajorYearAdmission2021.setMinGradeSeq("-");
	    					schoolMajorYearAdmission2021.setAvgGradeSeq("-");
	    				}
	    				
	    				if(zyadmission2021!=null) {
		    				zyplan2021=zyadmission2021.getPlan();
							schoolMajorYearAdmission2021.setMajorPlan(zyplan2021);
							if(zyadmission2021.getSubmit()!=null) {
								zysubmit2021=zyadmission2021.getSubmit();
							}
							zyadm2021=zyadmission2021.getAdmission();
							schoolMajorYearAdmission2021.setPlanSubmitAdmission(plan2021+"-"+adm2021);
	    				}
	    				
	    				
	    				SchoolMajorYearAdmission schoolMajorYearAdmission2020=new SchoolMajorYearAdmission();
		        		schoolMajorYearAdmission2020.setYear(yearNew3);
		        		schoolMajorYearAdmission2020.setMajorCode(schoolPlan.getMajorCode());
		        		schoolMajorYearAdmission2020.setMajorSeq(schoolPlan.getMajorSeq());
		        		schoolMajorYearAdmission2020.setMajor(schoolPlan.getMajorName());
		        		schoolMajorYearAdmission2020.setThisYearMajorPlan(schoolPlan.getMajorPlan());
		        		schoolMajorYearAdmission2020.setsCode(schoolPlan.getSchoolCode());
		        		schoolMajorYearAdmission2020.setZyz(schoolPlan.getZyz());
		        		
		        		
		        		if(provinceName.equals("广西")) {
		        			schoolMajorYearAdmission2020.setSeqGrade(new Integer(gxj2020).toString());
		        			schoolMajorYearAdmission2020.setSeq(new Integer(gxpw).toString());
	    				}else {
	    					schoolMajorYearAdmission2020.setSeqGrade(new Integer(qgj2020).toString());
	    					schoolMajorYearAdmission2020.setSeq(new Integer(qgpw).toString());
	    				}
	    				
	    				
	    				//设置分数线
	    				if("物理".equals(memberQuery.getSxkm())) {
	    					schoolMajorYearAdmission2020.setGradeLine(new Integer(gradeLineLg2020).toString());
	    				}
	    				if("历史".equals(memberQuery.getSxkm())) {
	    					schoolMajorYearAdmission2020.setGradeLine(new Integer(gradeLineWs2020).toString());
	    				}
	    				
	    				
	    				
	    				if(zyadmission2020!=null&&zyadmission2020.getAvgGrade()!=null) {
	    					schoolMajorYearAdmission2020.setAvgGradeStr(zyadmission2020.getAvgGrade().toString());
	    					schoolMajorYearAdmission2020.setMinGradeStr(zyadmission2020.getLowGrade().toString());
                            schoolMajorYearAdmission2020.setAdmission(zyadmission2020.getAdmission());
	    					zyavgGrade2020=zyadmission2020.getAvgGrade();
	    					zyminGrade2020=zyadmission2020.getLowGrade();
	    					
	    					
	    					
	    					//计算平均分排位，最低分排位
	    					int avgGrade2020Seq=99999999;
	    					int lastSeq=1;
	    					for(int m=0;m<hisPwGradeList.size();m++) {
	    						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
	    						if(hisGradeDoc.getYear().intValue()==yearNew3) {
	    							
	    							
	    							int myGrade=hisGradeDoc.getGrade();
	    							
	    							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
	    								if(hisGradeDoc.getUseIn().equals("广西")) {
	    									int fencha=myGrade-zyavgGrade2020;
	    									if(fencha==0) {
	    										avgGrade2020Seq=hisGradeDoc.getSeq();
	    										break;
	    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
	    										avgGrade2020Seq=lastSeq;
	    										break;
	    									}
	    									
	    									lastSeq=hisGradeDoc.getSeq();
	    									
	    								}
	    							}else {
	    								if(hisGradeDoc.getUseIn().equals("全国")) {
	    									int fencha=myGrade-zyavgGrade2020;
	    									if(fencha==0) {
	    										avgGrade2020Seq=hisGradeDoc.getSeq();
	    										break;
	    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
	    										avgGrade2020Seq=lastSeq;
	    										break;
	    									}
	    									
	    									lastSeq=hisGradeDoc.getSeq();
	    								}
	    							}
	    							
	    						}
	    					}
	    					
	    					schoolMajorYearAdmission2020.setAvgGradeSeq(new Integer(avgGrade2020Seq).toString());
	    					
	    					
	    					int minGrade2020Seq=99999999;
	    					lastSeq=1;
	    					for(int m=0;m<hisPwGradeList.size();m++) {
	    						GkGradeDoc hisGradeDoc=hisPwGradeList.get(m);
	    						if(hisGradeDoc.getYear().intValue()==yearNew3) {
	    							
	    							
	    							int myGrade=hisGradeDoc.getGrade();
	    							
	    							if(provinceName.equals("广西")) {//广西的学校，只统计广西的排位
	    								if(hisGradeDoc.getUseIn().equals("广西")) {
	    									int fencha=myGrade-zyminGrade2020;
	    									if(fencha==0) {
	    										minGrade2020Seq=hisGradeDoc.getSeq();
	    										break;
	    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
	    										minGrade2020Seq=lastSeq;
	    										break;
	    									}
	    									
	    									lastSeq=hisGradeDoc.getSeq();
	    									
	    								}
	    							}else {
	    								if(hisGradeDoc.getUseIn().equals("全国")) {
	    									int fencha=myGrade-zyminGrade2020;
	    									if(fencha==0) {
	    										minGrade2020Seq=hisGradeDoc.getSeq();
	    										break;
	    									}else if(fencha<0) {//当是负数时，上一个分叉的排序就是排位
	    										minGrade2020Seq=lastSeq;
	    										break;
	    									}
	    									
	    									lastSeq=hisGradeDoc.getSeq();
	    								}
	    							}
	    							
	    						}
	    					}
	    					schoolMajorYearAdmission2020.setMinGradeSeq(new Integer(minGrade2020Seq).toString());
	    					
	    					
	    					
	    					
	    				}else {
	    					schoolMajorYearAdmission2020.setAvgGradeStr("-");
	    					schoolMajorYearAdmission2020.setMinGradeStr("-");
	    					
	    					schoolMajorYearAdmission2020.setAvgGradeSeq("-");
	    					schoolMajorYearAdmission2020.setMinGradeSeq("-");
	    				}
	    				if(zyadmission2020!=null) {
	    				
		    				zyplan2020=zyadmission2020.getPlan();
							schoolMajorYearAdmission2020.setMajorPlan(zyplan2020);
							if(zyadmission2020.getSubmit()!=null) {
								zysubmit2020=zyadmission2020.getSubmit();
							}
							zyadm2020=zyadmission2020.getAdmission();
							schoolMajorYearAdmission2020.setPlanSubmitAdmission(plan2020+"-"+adm2020);
	    				}
	    				
	    				//开始计算投档概率
	    				
	    				/****
        				 * 专科的录取概率计算
        				 * 2024年的分数为a，2023年的院校录取最低分为b,a-b除2—再加50%等于院校专业组投档概率。2024年的分数为c，2023年的专业录取最低分为d,c-d除2—再加50%等于院校专业录取概率。
        				 */
        				if(provinceName.equals("广西")) {//广西学校
        					int userGrade=memberQuery.getGxgrade();
        					double rate=(userGrade-zyminGrade2022)/2+50;
        					if(rate>=100) rate=99.99;
							if(rate<1) rate=1;
							schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
							schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
							schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
        				}else {//全国学校
        					if(qgjfFlag) {//认可加分
        						int userGrade=memberQuery.getQggrade();
            					double rate=(userGrade-zyminGrade2022)/2+50;
            					if(rate>=100) rate=99.99;
    							if(rate<1) rate=1;
    							schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
    							schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
    							schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
        					}else {
        						int userGrade=memberQuery.getGrade();
            					double rate=(userGrade-zyminGrade2022)/2+50;
            					if(rate>=100) rate=99.99;
    							if(rate<1) rate=1;
    							schoolMajorYearAdmission2020.setSubmitRate(df.format(rate));
    							schoolMajorYearAdmission2021.setSubmitRate(df.format(rate));
    							schoolMajorYearAdmission2022.setSubmitRate(df.format(rate));
        					}
        					
        				}
	    				
	    				
	    				
	    				if(schoolMajorYearAdmission2022.getSubmitRate()==null) {
	    					schoolMajorYearAdmission2022.setSubmitRate("-");
	    				}
	    				
	    				if(schoolMajorYearAdmission2022.getPlanSubmitAdmission()==null) {
	    					schoolMajorYearAdmission2022.setPlanSubmitAdmission("-");
	    				}
	    				
	    				if(schoolMajorYearAdmission2022.getAvgGradeSeq()==null||schoolMajorYearAdmission2022.getAvgGradeSeq().equals("99999999")) {
	    					schoolMajorYearAdmission2022.setAvgGradeSeq("-");
	    				}
	    				
	    				if(schoolMajorYearAdmission2022.getMinGradeSeq()==null||schoolMajorYearAdmission2022.getMinGradeSeq().equals("99999999")) {
	    					schoolMajorYearAdmission2022.setMinGradeSeq("-");
	    				}
	    				
	    				if(schoolMajorYearAdmission2021.getSubmitRate()==null) {
	    					schoolMajorYearAdmission2021.setSubmitRate("-");
	    					
	    				}
	    				if(schoolMajorYearAdmission2021.getPlanSubmitAdmission()==null) {
	    					schoolMajorYearAdmission2021.setPlanSubmitAdmission("-");
	    				}
	    				
	    				
	    				if(schoolMajorYearAdmission2021.getAvgGradeSeq()==null||schoolMajorYearAdmission2021.getAvgGradeSeq().equals("99999999")) {
	    					schoolMajorYearAdmission2021.setAvgGradeSeq("-");
	    				}
	    				
	    				if(schoolMajorYearAdmission2021.getMinGradeSeq()==null||schoolMajorYearAdmission2021.getMinGradeSeq().equals("99999999")) {
	    					schoolMajorYearAdmission2021.setMinGradeSeq("-");
	    				}
	    				
	    				if(schoolMajorYearAdmission2020.getSubmitRate()==null) {
	    					schoolMajorYearAdmission2020.setSubmitRate("-");
	    				}
	    				if(schoolMajorYearAdmission2020.getPlanSubmitAdmission()==null) {
	    					schoolMajorYearAdmission2020.setPlanSubmitAdmission("-");
	    				}
	    				
	    				if(schoolMajorYearAdmission2022.getMajorPlan()==null) {
	    					schoolMajorYearAdmission2022.setMajorPlan(9999);
							schoolMajorYearAdmission2022.setMajorPlanStr("-");
						}else{
							schoolMajorYearAdmission2022.setMajorPlanStr(schoolMajorYearAdmission2022.getMajorPlan().toString());
						}
	    				
	    				if(schoolMajorYearAdmission2021.getMajorPlan()==null) {
	    					schoolMajorYearAdmission2021.setMajorPlan(9999);
							schoolMajorYearAdmission2021.setMajorPlanStr("-");
						}else{
							schoolMajorYearAdmission2021.setMajorPlanStr(schoolMajorYearAdmission2021.getMajorPlan().toString());
						}
	    				
	    				if(schoolMajorYearAdmission2020.getMajorPlan()==null) {
	    					schoolMajorYearAdmission2020.setMajorPlan(9999);
							schoolMajorYearAdmission2020.setMajorPlanStr("-");
						}else{
							schoolMajorYearAdmission2020.setMajorPlanStr(schoolMajorYearAdmission2020.getMajorPlan().toString());
						}
	    				
	    				if(schoolMajorYearAdmission2020.getAvgGradeSeq()==null||schoolMajorYearAdmission2020.getAvgGradeSeq().equals("99999999")) {
	    					schoolMajorYearAdmission2020.setAvgGradeSeq("-");
	    				}
	    				
	    				if(schoolMajorYearAdmission2020.getMinGradeSeq()==null||schoolMajorYearAdmission2020.getMinGradeSeq().equals("99999999")) {
	    					schoolMajorYearAdmission2020.setMinGradeSeq("-");
	    				}
	    				
	    				
	    				
	    				returnSchool.setSubmitZyRate(schoolMajorYearAdmission2022.getSubmitRate());//专业投档概率
	    				returnList.add(returnSchool);
    				
	        		}
    				
	        		
    				
	        		
	        	}
	        	
	        	
	        	
	        	
	        	
	        	
	        	
        	}
        	
        	
        	
        	//循环累计专业组招生计划
        	if(returnList!=null&&returnList.size()>0) {
            	
            	for(int y=0;y< zyzList.size();y++) {
            		SchoolPlan zyzPlan=zyzList.get(y);//取出专业组
            		
            		int myZyzPlan=0;//专业组招生人数总数
            		
            		for(int i=0;i<returnList.size();i++) {
                		School school=returnList.get(i);
                		
                		if(zyzPlan.getSchoolCode().equals(school.getScode())&&zyzPlan.getZyz().equals(school.getZyz())) {
                			Integer majorPlan= school.getThisYearMajorPlan();
                			if(majorPlan==null) majorPlan=0;
                			myZyzPlan=myZyzPlan+majorPlan;
                		}
                		
                	}
            		
            		for(int i=0;i<returnList.size();i++) {
                		School school=returnList.get(i);
                		
                		if(zyzPlan.getSchoolCode().equals(school.getScode())&&zyzPlan.getZyz().equals(school.getZyz())) {
                			school.setThisYearZyzPlan(myZyzPlan);
                		}
            		}
            	}
            	
            	
            }
        	
        	
        	
        }else {
        	return AjaxResult.error("找不到学校信息");
        }
    	
        
        
    	
    	return AjaxResult.success(returnList);
    }
    
    
    
    @ApiOperation("会员登录")
    @GetMapping("/loginMember")
    public AjaxResult loginMember(String phone, String mobileCode) {

    	
    	if(phone==null||phone.trim().equals("")) {
    		return error("请填写手机号码");
    	}
    	
    	if(mobileCode==null||mobileCode.trim().equals("")) {
    		return error("请填写短信验证码");
    	}
    	
    	if(isSpecialChar(phone.toString())||sqlValidate(phone.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	if(isSpecialChar(mobileCode.toString())||sqlValidate(mobileCode.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
	    
    	//按密码查询，看看能否登录
    	BuzMember memberQuery=new BuzMember();
    	memberQuery.setPhone(phone);
    	memberQuery.setPwd(mobileCode);
    	List<BuzMember> memberList2=buzMemberService.selectBuzMemberList(memberQuery);
    	if(memberList2!=null&&memberList2.size()>0) {//根据用户名和密码能够查询到用户
    		
    		return AjaxResult.success(memberList2.get(0));
    	}else {////根据用户名和密码能够查询不到用户，根据短信验证码查询
    		
    		
    		Map map = checkMobileCode(phone, mobileCode);// 调用通用短信验证码方法
    		String status = (String) map.get("status");
    		List<YxSms> tsms = (List) map.get("list");
    		if (!status.contentEquals("0")) {// 短信验证异常
    			return AjaxResult.error((String) map.get("msg"));
    		}

    		if (tsms == null && tsms.size() == 0) {
    			return AjaxResult.error((String) map.get("msg"));
    		}
    		
    		memberQuery=new BuzMember();
        	memberQuery.setPhone(phone);
        	memberList2=buzMemberService.selectBuzMemberList(memberQuery);
        	if(memberList2!=null&&memberList2.size()>0) {
        		return AjaxResult.success(memberList2.get(0));
        	}else {
        		
        		return AjaxResult.error("会员信息不存在，请先注册成为会员");
        	}
    	}
    		
		
		
    	

        
    }


    @Log(title = "会员注册--应该是这个接口，把openid传过来一下")
    @ApiOperation("保存用户信息")
    @GetMapping("/saveMember")
    public AjaxResult saveMember(String phone,String openId,Integer grade,Integer qggrade,Integer gxgrade,String sxkm,String zxkm,Integer sfssmz,Integer sfgjzxdfzx,Integer sfdfzx,String yzm,String ruser,String pwd,String cardNo,String cardPwd) {
    	// 获取OpenId
    	//String openId = getUsername();
    	//System.out.println(buzMember.toString());
    	
    	System.out.println("===================openid========"+openId) ;
		if(StrUtil.isEmpty(phone)) {
    		return error("请填写手机号码");
    	}
		if(StrUtil.isEmpty(yzm)) {
    		return error("请填写短信验证码");
    	}
		if(StrUtil.isEmpty(pwd)) {
    		return error("请填写密码");
    	}
/*
    	if(grade==null||grade.intValue()==0) {
    		return error("请填写高考成绩");
    	}
*/
    	
    	if(qggrade==null||qggrade.intValue()==0) {
    		return error("请填写区外高校总分(含加分)");
    	}

    	if(gxgrade==null||gxgrade.intValue()==0) {
    		return error("请填写区内高校总分(含加分)");
    	}


    	if(StrUtil.isEmpty(sxkm)) {
    		return error("请填写首选科目");
    	}
    	
    	if(StrUtil.isEmpty(zxkm)) {
    		return error("请填写再选科目");
    	}
    	

    	if(sfssmz==null) {
    		return error("请选择是否少数民族");
    	}


    	
    	if(StrUtil.isNotEmpty(openId)) {
    		if(isSpecialChar(openId.toString())||sqlValidate(openId.toString())){
        		AjaxResult.error("参数包含非法字符");
        	}
    	}
    	
    	if(ruser!=null&&!ruser.trim().equals("")) {
    		if(isSpecialChar(ruser.toString())||sqlValidate(ruser.toString())){
        		AjaxResult.error("参数包含非法字符");
        	}
    	}
    	
    	if(isSpecialChar(phone.toString())||sqlValidate(phone.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	if(isSpecialChar(yzm.toString())||sqlValidate(yzm.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	if(sqlValidate(pwd.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
/*
    	if(isSpecialChar(grade.toString())||sqlValidate(grade.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
*/


    	if(isSpecialChar(qggrade.toString())||sqlValidate(qggrade.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	if(isSpecialChar(gxgrade.toString())||sqlValidate(gxgrade.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}


    	
    	if(isSpecialChar(sxkm.toString())||sqlValidate(sxkm.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	if(isSpecialChar(zxkm.toString())||sqlValidate(zxkm.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}


    	if(sfssmz!=null&&isSpecialChar(sfssmz.toString())||sqlValidate(sfssmz.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	
    	

    	if(sfgjzxdfzx!=null&&isSpecialChar(sfgjzxdfzx.toString())||sqlValidate(sfgjzxdfzx.toString())) {
            AjaxResult.error("参数包含非法字符");
    	}
    	
    	if(sfdfzx!=null&&isSpecialChar(sfdfzx.toString())||sqlValidate(sfdfzx.toString())) {
            AjaxResult.error("参数包含非法字符");
    	}

        if(sfssmz!=null&&isSpecialChar(sfssmz.toString())||sqlValidate(sfssmz.toString())) {
            AjaxResult.error("参数包含非法字符");
        }

    		
		Map map = checkMobileCode(phone, yzm);// 调用通用短信验证码方法
		String status = (String) map.get("status");
		List<YxSms> tsms = (List) map.get("list");
		if (!status.contentEquals("0")) {// 短信验证异常
			return AjaxResult.error((String) map.get("msg"));
		}

		if (tsms == null && tsms.size() == 0) {
			return AjaxResult.error((String) map.get("msg"));
		}






		
    	BuzMember memberQuery=new BuzMember();
    	memberQuery.setPhone(phone);
    	List<BuzMember> memberList2=buzMemberService.selectBuzMemberList(memberQuery);
    	if(memberList2!=null&&memberList2.size()>0) {
            memberQuery=memberList2.get(0);
            boolean isvip=false;
            if(cardNo!=null&&!cardNo.equals("")){
                if(isSpecialChar(cardNo)||sqlValidate(cardNo)) {
                    AjaxResult.error("参数包含非法字符");
                }

                if(cardPwd!=null&&!cardPwd.equals("")){
                    if(isSpecialChar(cardPwd)||sqlValidate(cardPwd)) {
                        AjaxResult.error("参数包含非法字符");
                    }

					memberQuery.setCardNo(cardNo);
					memberQuery.setCardPwd(cardPwd);
					buzMemberService.updateBuzMember(memberQuery);

                    //查找会员卡号和密码
                    GkCard cardQuery=new GkCard();
                    cardQuery.setCardNo(new Long(cardNo));
                    cardQuery.setPwd(cardPwd);
                    List<GkCard> cardList=gkCardService.selectGkCardList(cardQuery);
                    if(cardList!=null&&cardList.size()>0){
                        GkCard card=cardList.get(0);
                        if(card.getZt()==1){
                            AjaxResult.error("会员卡号已经被使用，无法再激活");
                        }else{
                            isvip=true;
                            card.setZt(new Long(1));
                            card.setActiveTime(new Date());
                            card.setActiveMemberId(memberQuery.getId());
                            gkCardService.updateGkCard(card);
                        }
                    }else{
                        AjaxResult.error("卡号和密码不正确");
                    }
                }
            }

    		if(openId!=null&&!openId.trim().equals("")) {
    			if(memberQuery.getOpenid()==null||memberQuery.getOpenid().equals("")) {
    				memberQuery.setOpenid(openId);
                    if(isvip){
                        memberQuery.setSfvip(1);
                    }
    				buzMemberService.updateBuzMember(memberQuery);
    			}
    		}
    		return AjaxResult.success(memberList2.get(0));
    	}else {

    		
    		memberQuery.setGrade(qggrade);
    		memberQuery.setPwd(pwd);
    		memberQuery.setYear(DateUtil.thisYear());
    		memberQuery.setQggrade(qggrade);
    		memberQuery.setGxgrade(gxgrade);
    		memberQuery.setSxkm(sxkm);
    		memberQuery.setZxkm(zxkm);
			memberQuery.setCardNo(cardNo);
			memberQuery.setCardPwd(cardPwd);
            if(sfssmz!=null) {
                memberQuery.setSfssmz(sfssmz);
            }
    		if(openId!=null&&!openId.trim().equals("")) {
    			memberQuery.setOpenid(openId);   		
    		}
    		if(ruser!=null&&!ruser.trim().equals("")) {
    			memberQuery.setRuser(ruser);   		
    		}
			memberQuery.setUserType(1);
            if(sfgjzxdfzx!=null) {
                memberQuery.setSfgjzxdfzx(sfgjzxdfzx);
            }
            if(sfdfzx!=null) {
                memberQuery.setSfdfzx(sfdfzx);
            }
    		memberQuery.setId(IdUtil.getSnowflakeNextIdStr());

            //设置用户分数排名
            //广西排位分
            GkGradeDoc gkGradeDoc=new GkGradeDoc();
            gkGradeDoc.setYear(gradeLineYear);
            if("物理".equals(memberQuery.getSxkm())) {
                gkGradeDoc.setGradeClass("工类");
            }
            if("历史".equals(memberQuery.getSxkm())) {
                gkGradeDoc.setGradeClass("史类");
            }
            gkGradeDoc.setUseIn("广西");
            List<GkGradeDoc> gradeList=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);
            for(int i=0;i<gradeList.size();i++){
                GkGradeDoc gradeDoc=gradeList.get(i);
                if(gradeDoc.getGrade().intValue()==memberQuery.getGxgrade().intValue()){
                    memberQuery.setGradePmGx(gradeDoc.getSeq());
                }
            }


            //全国认可加分排位分
            gkGradeDoc=new GkGradeDoc();
            gkGradeDoc.setYear(gradeLineYear);
            if("物理".equals(memberQuery.getSxkm())) {
                gkGradeDoc.setGradeClass("工类");
            }
            if("历史".equals(memberQuery.getSxkm())) {
                gkGradeDoc.setGradeClass("史类");
            }

            gkGradeDoc.setUseIn("全国");
            List<GkGradeDoc> gradeList2=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);
            for(int i=0;i<gradeList2.size();i++){
                GkGradeDoc gradeDoc=gradeList2.get(i);
                if(gradeDoc.getGrade().intValue()==memberQuery.getQggrade().intValue()){
                    memberQuery.setGradePm(gradeDoc.getSeq());
                }
            }


            boolean isvip=false;
            if(cardNo!=null&&!cardNo.equals("")){
                if(isSpecialChar(cardNo)||sqlValidate(cardNo)) {
                    AjaxResult.error("参数包含非法字符");
                }

                if(cardPwd!=null&&!cardPwd.equals("")){
                    if(isSpecialChar(cardPwd)||sqlValidate(cardPwd)) {
                        AjaxResult.error("参数包含非法字符");
                    }

                    //查找会员卡号和密码
                    GkCard cardQuery=new GkCard();
                    cardQuery.setCardNo(new Long(cardNo));
                    cardQuery.setPwd(cardPwd);
                    List<GkCard> cardList=gkCardService.selectGkCardList(cardQuery);
                    if(cardList!=null&&cardList.size()>0){
                        GkCard card=cardList.get(0);
                        if(card.getZt()==1){
                            AjaxResult.error("会员卡号已经被使用，无法再激活");
                        }else{
                            isvip=true;

                            card.setZt(new Long(1));
                            card.setActiveTime(new Date());
                            card.setActiveMemberId(memberQuery.getId());
                            gkCardService.updateGkCard(card);
                        }
                    }else{
                        AjaxResult.error("卡号和密码不正确");
                    }
                }
            }

            if(isvip){
                memberQuery.setSfvip(1);
            }

    		buzMemberService.insertBuzMember(memberQuery);

            //生成考生近3年的同位分(全国)
            List<BuzMemberGrade> list=new ArrayList();

            GkGradeDoc gkGradeDocQuery=new GkGradeDoc();
            if("物理".equals(memberQuery.getSxkm())) {
                gkGradeDocQuery.setGradeClass("工类");
            }
            if("历史".equals(memberQuery.getSxkm())) {
                gkGradeDocQuery.setGradeClass("史类");
            }
            gkGradeDocQuery.setUseIn("全国");
            gkGradeDocQuery.setSeq(memberQuery.getGradePm());
            List<GkGradeDoc> gradeDocList=gkGradeDocService.selectGkGradeDocListBySeq(gkGradeDocQuery);
            if(gradeDocList.size()<=6) {
                for (int i = 0; i < gradeDocList.size(); i++) {
                    GkGradeDoc doc = gradeDocList.get(i);
                    BuzMemberGrade grade2023 = new BuzMemberGrade();
                    grade2023.setMemberId(memberQuery.getId());
                    grade2023.setYear(doc.getYear());
                    grade2023.setPmGrade(doc.getGrade());
                    list.add(grade2023);
                }
            }

            gkGradeDocQuery=new GkGradeDoc();
            if("物理".equals(memberQuery.getSxkm())) {
                gkGradeDocQuery.setGradeClass("工类");
            }
            if("历史".equals(memberQuery.getSxkm())) {
                gkGradeDocQuery.setGradeClass("史类");
            }
            gkGradeDocQuery.setUseIn("广西");
            gkGradeDocQuery.setSeq(memberQuery.getGradePmGx());
            List<GkGradeDoc> gradeDocListGx=gkGradeDocService.selectGkGradeDocListBySeq(gkGradeDocQuery);
            if(gradeDocListGx.size()<=6) {
                for (int j = 0; j < list.size(); j++) {
                    BuzMemberGrade grade2023 = list.get(j);
                    Integer year = grade2023.getYear();
                    for (int i = 0; i < gradeDocListGx.size(); i++) {
                        GkGradeDoc doc = gradeDocListGx.get(i);
                        Integer year2 = doc.getYear();
                        if (year.intValue() == year2.intValue()) {
                            grade2023.setPmGradeGx(doc.getGrade());
                            break;
                        }
                    }
                }
            }
            if(list.size()>0) {
                buzMemberGradeService.insertBuzMemberGradeList(list);
            }

			//会员注册成功后，向易指路同步用户注册信息
			try{
				HttpRequest postRequest = HttpUtil.createPost("https://fc-mp-c3a2da4b-b0e0-4e19-9266-821508fec011.next.bspapp.com/http/router/checkUserRes");
				postRequest.header("Content-Type", "application/json");
				postRequest.body("{\"telephone\":\""+phone+"\",\"appid\":\"gxxgk\",\"secret\":\"gxxgk5s7h1\",\"regres\":\"1\"}");
				HttpResponse postResponse = postRequest.execute();
			}catch (Exception e){
				e.printStackTrace();
			}


    		return AjaxResult.success(memberQuery);
    	}

        
    }



	@ApiOperation("绑定会员卡号和激活码")
	@GetMapping("/bingCard")
	public AjaxResult bingCard(String userId,String cardNo,String cardPwd) {




		if (userId == null || userId.trim().equals("")) {
			return error("请先登录");
		}


		if (cardNo == null || cardNo.trim().equals("")) {
			return error("请填写会员卡号");
		}

		if (cardPwd == null || cardPwd.trim().equals("")) {
			return error("请填写激活码");
		}

		if (isSpecialChar(userId.toString()) || sqlValidate(userId.toString())) {
			return AjaxResult.error("参数包含非法字符");
		}

		if (isSpecialChar(cardNo.toString()) || sqlValidate(cardNo.toString())) {
			return AjaxResult.error("参数包含非法字符");
		}

		if (isSpecialChar(cardPwd.toString()) || sqlValidate(cardPwd.toString())) {
			return AjaxResult.error("参数包含非法字符");
		}

        //查询卡号和密码是否可用
		GkCard card=new GkCard();
		card.setCardNo(new Long(cardNo));
        card.setPwd(cardPwd);
		List<GkCard> cardList=gkCardService.selectGkCardList(card);
		if(cardList!=null&&cardList.size()>0){
			card=cardList.get(0);
			if(card.getZt().intValue()==0) {
                BuzMember memberQuery = buzMemberService.selectBuzMemberById(userId);
                memberQuery.setCardNo(cardNo);
                memberQuery.setCardPwd(cardPwd);
                buzMemberService.updateBuzMember(memberQuery);

				card.setZt(1L);
				card.setActiveTime(new Date());
                card.setActiveMemberId(memberQuery.getId());
				gkCardService.updateGkCard(card);

                return AjaxResult.success(memberQuery);
            }else{
				return AjaxResult.error("会员卡号已经被使用");
			}
		}else{
			return AjaxResult.error("会员卡号和密码不存在");
		}


	}
    
    
    
    
    @ApiOperation("更新会员信息")
    @GetMapping("/updateMember")
    public AjaxResult updateMember(String phone, Integer grade,Integer qggrade,Integer gxgrade,String sxkm,String zxkm,Integer sfssmz,Integer sfgjzxdfzx,Integer sfdfzx,String cardNo,String cardPwd) {

		System.out.println("-----updateMember----qggrade---"+qggrade+"-------gxgrade---"+gxgrade);
    	


		if(phone==null||phone.trim().equals("")) {
    		return error("请填写手机号码");
    	}

		if(phone.equals("18677194748")){
			return error("游客账号，无法修改分数。请您注册并登录自己的账号使用。");
		}

        /*
    	if(grade==null) {
    		return error("请填写高考分数");
    	}

         */

    	if(qggrade==null) {
    		return error("请填写区外高考总分(含加分)");
    	}
    	
    	if(gxgrade==null) {
    		return error("请填写区内高考总分(含加分)");
    	}


    	
    	if(sxkm==null||sxkm.trim().equals("")) {
    		return error("请填写首选科目");
    	}
    	
    	if(zxkm==null||zxkm.trim().equals("")) {
    		return error("请填写再选科目");
    	}
    	
    	if(isSpecialChar(phone.toString())||sqlValidate(phone.toString())){
			return AjaxResult.error("参数包含非法字符");
    	}
    	
    	if(isSpecialChar(sxkm.toString())||sqlValidate(sxkm.toString())){
			return AjaxResult.error("参数包含非法字符");
    	}
    	
    	if(isSpecialChar(zxkm.toString())||sqlValidate(zxkm.toString())){
			return AjaxResult.error("参数包含非法字符");
    	}

        if(sfssmz!=null&&isSpecialChar(sfssmz.toString())||sqlValidate(sfssmz.toString())){
			return AjaxResult.error("参数包含非法字符");
        }




        if(sfgjzxdfzx!=null&&isSpecialChar(sfgjzxdfzx.toString())||sqlValidate(sfgjzxdfzx.toString())) {
			return AjaxResult.error("参数包含非法字符");
        }

        if(sfdfzx!=null&&isSpecialChar(sfdfzx.toString())||sqlValidate(sfdfzx.toString())) {
			return AjaxResult.error("参数包含非法字符");
        }
		
		
    	BuzMember memberQuery=new BuzMember();
    	memberQuery.setPhone(phone);
    	List<BuzMember> memberList2=buzMemberService.selectBuzMemberList(memberQuery);
    	if(memberList2!=null&&memberList2.size()>0) {
    		
    		memberQuery=memberList2.get(0);



    		memberQuery.setGrade(qggrade);
    		memberQuery.setGxgrade(gxgrade);
    		memberQuery.setQggrade(qggrade);
    		
    		memberQuery.setSxkm(sxkm);
    		memberQuery.setZxkm(zxkm);

            if(sfssmz!=null) {
                memberQuery.setSfssmz(sfssmz);
            }
            memberQuery.setUserType(1);
            if(sfgjzxdfzx!=null) {
                memberQuery.setSfgjzxdfzx(sfgjzxdfzx);
            }
            if(sfdfzx!=null) {
                memberQuery.setSfdfzx(sfdfzx);
            }
			if(cardNo!=null&&!cardNo.equals("")) {
				memberQuery.setCardNo(cardNo);
			}
			if(cardPwd!=null&&!cardPwd.equals("")) {
				memberQuery.setCardPwd(cardPwd);
			}

            //设置用户分数排名
            //广西排位分
            GkGradeDoc gkGradeDoc=new GkGradeDoc();
            gkGradeDoc.setYear(gradeLineYear);
            if("物理".equals(memberQuery.getSxkm())) {
                gkGradeDoc.setGradeClass("工类");
            }
            if("历史".equals(memberQuery.getSxkm())) {
                gkGradeDoc.setGradeClass("史类");
            }
            gkGradeDoc.setUseIn("广西");
            List<GkGradeDoc> gradeList=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);
            for(int i=0;i<gradeList.size();i++){
                GkGradeDoc gradeDoc=gradeList.get(i);
                if(gradeDoc.getGrade().intValue()==memberQuery.getGxgrade().intValue()){
                    memberQuery.setGradePmGx(gradeDoc.getSeq());
                }
            }


            //全国认可加分排位分
            gkGradeDoc=new GkGradeDoc();
            gkGradeDoc.setYear(gradeLineYear);
            if("物理".equals(memberQuery.getSxkm())) {
                gkGradeDoc.setGradeClass("工类");
            }
            if("历史".equals(memberQuery.getSxkm())) {
                gkGradeDoc.setGradeClass("史类");
            }

            gkGradeDoc.setUseIn("全国");
            List<GkGradeDoc> gradeList2=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);
            for(int i=0;i<gradeList2.size();i++){
                GkGradeDoc gradeDoc=gradeList2.get(i);
                if(gradeDoc.getGrade().intValue()==memberQuery.getQggrade().intValue()){
                    memberQuery.setGradePm(gradeDoc.getSeq());
                }
            }

            if(memberQuery.getSfvip().intValue()==0) {

                boolean isvip = false;
                if (cardNo != null && !cardNo.equals("")) {
                    if (isSpecialChar(cardNo) || sqlValidate(cardNo)) {
                        AjaxResult.error("参数包含非法字符");
                    }

                    if (cardPwd != null && !cardPwd.equals("")) {
                        if (isSpecialChar(cardPwd) || sqlValidate(cardPwd)) {
                            AjaxResult.error("参数包含非法字符");
                        }

                        //查找会员卡号和密码
                        GkCard cardQuery = new GkCard();
                        cardQuery.setCardNo(new Long(cardNo));
                        cardQuery.setPwd(cardPwd);
                        List<GkCard> cardList = gkCardService.selectGkCardList(cardQuery);
                        if (cardList != null && cardList.size() > 0) {
                            GkCard card = cardList.get(0);
                            if (card.getZt() == 1) {
                                AjaxResult.error("会员卡号已经被使用，无法再激活");
                            } else {
                                isvip = true;

                                card.setZt(new Long(1));
                                card.setActiveTime(new Date());
                                card.setActiveMemberId(memberQuery.getId());
                                gkCardService.updateGkCard(card);
                            }
                        } else {
                            AjaxResult.error("卡号和密码不正确");
                        }
                    }
                }

                if (isvip) {
                    memberQuery.setSfvip(1);
                }
            }

            //删除已有同违法
            buzMemberGradeService.deleteBuzMemberGradeByMemberId(memberQuery.getId());

            //生成考生近3年的同位分(全国)
            List<BuzMemberGrade> list=new ArrayList();

            GkGradeDoc gkGradeDocQuery=new GkGradeDoc();
            if("物理".equals(memberQuery.getSxkm())) {
                gkGradeDocQuery.setGradeClass("工类");
            }
            if("历史".equals(memberQuery.getSxkm())) {
                gkGradeDocQuery.setGradeClass("史类");
            }
            gkGradeDocQuery.setUseIn("全国");
            gkGradeDocQuery.setSeq(memberQuery.getGradePm());
            List<GkGradeDoc> gradeDocList=gkGradeDocService.selectGkGradeDocListBySeq(gkGradeDocQuery);
            if(gradeDocList.size()<=6) {
                for (int i = 0; i < gradeDocList.size(); i++) {
                    GkGradeDoc doc = gradeDocList.get(i);
                    BuzMemberGrade grade2023 = new BuzMemberGrade();
                    grade2023.setMemberId(memberQuery.getId());
                    grade2023.setYear(doc.getYear());
                    grade2023.setPmGrade(doc.getGrade());
                    list.add(grade2023);
                }
            }

            gkGradeDocQuery=new GkGradeDoc();
            if("物理".equals(memberQuery.getSxkm())) {
                gkGradeDocQuery.setGradeClass("工类");
            }
            if("历史".equals(memberQuery.getSxkm())) {
                gkGradeDocQuery.setGradeClass("史类");
            }
            gkGradeDocQuery.setUseIn("广西");
            gkGradeDocQuery.setSeq(memberQuery.getGradePmGx());
            List<GkGradeDoc> gradeDocListGx=gkGradeDocService.selectGkGradeDocListBySeq(gkGradeDocQuery);
            if(gradeDocListGx.size()<=6) {
                for (int j = 0; j < list.size(); j++) {
                    BuzMemberGrade grade2023 = list.get(j);
                    Integer year = grade2023.getYear();
                    for (int i = 0; i < gradeDocListGx.size(); i++) {
                        GkGradeDoc doc = gradeDocListGx.get(i);
                        Integer year2 = doc.getYear();
                        if (year.intValue() == year2.intValue()) {
                            grade2023.setPmGradeGx(doc.getGrade());
                            break;
                        }
                    }
                }
            }
            if(list.size()>0) {
                buzMemberGradeService.insertBuzMemberGradeList(list);
            }
    		
    		return AjaxResult.success(buzMemberService.updateBuzMember(memberQuery));
    	}else {
    		
    		return AjaxResult.error("会员信息不存在，请先注册成为会员");
    	}

        
    }
    
    @ApiOperation("会员登录")
    @GetMapping("/loginMemberById")
    public AjaxResult loginMemberById(String useId) {

		System.out.println("------------loginMemberById--------------"+useId);
    	if(useId==null||useId.equals("")) useId="1927183845081636864";
		if(useId.equals("1923011559952904192")) useId="1927183845081636864";
    	if(isSpecialChar(useId.toString())||sqlValidate(useId.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	BuzMember memberQuery=buzMemberService.selectBuzMemberById(useId);
		if("物理".equals(memberQuery.getSxkm())) {
			memberQuery.setGradeLine(thisYearLgGradeLine);
		}else{
			memberQuery.setGradeLine(thisYearWsGradeLine);
		}

    	if(memberQuery!=null&&memberQuery.getPhone()!=null) {
    		return AjaxResult.success(memberQuery);
    	}else {
    		
    		return AjaxResult.error("会员信息不存在，请先注册成为会员");
    	}

        
    }

	@ApiOperation("会员登录")
	@GetMapping("/loginMemberById2")
	public AjaxResult loginMemberById2(String useId) {

		if(isSpecialChar(useId.toString())||sqlValidate(useId.toString())){
			AjaxResult.error("参数包含非法字符");
		}

		BuzMember memberQuery=buzMemberService.selectBuzMemberById(useId);

		if(memberQuery!=null&&memberQuery.getPhone()!=null) {
			return AjaxResult.success(memberQuery);
		}else {

			return AjaxResult.error("会员信息不存在，请先注册成为会员");
		}


	}

	@ApiOperation("获取专家长图")
	@GetMapping("/getZhuanjia")
	public String getZhuanjia() {

		String url="https://gaokao.s3.cn-north-1.jdcloud-oss.com/%E4%B8%93%E5%AE%B63.png";
		return url;

	}

	@ApiOperation("获取会员的投档总体情况")
	@GetMapping("/showSubmit")
	public AjaxResult showSubmit(String useId) {

		if(useId==null||useId.equals("")) useId="1927183845081636864";
		if(isSpecialChar(useId.toString())||sqlValidate(useId.toString())){
			AjaxResult.error("参数包含非法字符");
		}

		BuzMember memberQuery=buzMemberService.selectBuzMemberById(useId);

		if(memberQuery!=null&&memberQuery.getPhone()!=null) {

			/**
			*院校专业组的投档概率:拿考生输人的成绩a直接和去年的各院校专业组的投档线比较b，a－b=c,如果c＜－30(或等于－30）以下，属于冲的，-31＜c＜0的，属于争，0＜c＜30(或等于30)，属于稳，30＜c＜70(或等于70)，属于守，70＜c以上属于保。各院校专业组投档概率显示为【c➗ 2+50】%
			* a=考生成绩-各专业组最低录取分数线
			 * -100<a<=-30  冲
			 * -30<a<=0   争
			 * 0<a<=30  稳
			 * 30<a<=70 守
			 * 70<a<=100保
			 * 投档概率=a/2+50
			 * */

			if(memberQuery.getSxkm()!=null&&memberQuery.getGrade()!=null){
				SchoolPlan schoolPlanQuery=new SchoolPlan();
				schoolPlanQuery.setYear(thisYear);
				if("物理".equals(memberQuery.getSxkm())) {
					schoolPlanQuery.setMajorType("理工类");
				}
				if("历史".equals(memberQuery.getSxkm())) {
					schoolPlanQuery.setMajorType("文史类");
				}
				schoolPlanQuery.setMajorPlan(memberQuery.getGrade());
				List<SchoolPlan> plans2024List =schoolPlanService.selectSchoolZyz2024PlanList(schoolPlanQuery);

				List<School> schoolListC=new ArrayList();
				List<School> schoolListZ=new ArrayList();
				List<School> schoolListW=new ArrayList();
				List<School> schoolListS=new ArrayList();
				List<School> schoolListB=new ArrayList();

				List<School> schoolListAll=new ArrayList();

				int ksGrade=memberQuery.getGrade();

				for(int i=0;i<plans2024List.size();i++){
					SchoolPlan plan=plans2024List.get(i);

					boolean existFlag2=false;
					for(int j=0;j<schoolListAll.size();j++){
						School school=schoolListAll.get(j);
						if(school.getScode().equals(plan.getSchoolCode())){
							existFlag2=true;
							break;
						}
					}
					if(!existFlag2){
						School school=new School();
						school.setScode(plan.getSchoolCode());
						schoolListAll.add(school);
					}
					if(plan.getGrade()!=null) {
                        int grade = plan.getGrade();
                        int cha = ksGrade - grade;
                        if (cha <= -30) {
                            boolean existFlag = false;
                            for (int j = 0; j < schoolListC.size(); j++) {
                                School school = schoolListC.get(j);
                                if (school.getScode().equals(plan.getSchoolCode())) {
                                    existFlag = true;
                                    break;
                                }
                            }
                            if (!existFlag) {
                                School school = new School();
                                school.setScode(plan.getSchoolCode());
                                schoolListC.add(school);
                            }
                        }

                        if (cha > -30 && cha <= 0) {
                            boolean existFlag = false;
                            for (int j = 0; j < schoolListZ.size(); j++) {
                                School school = schoolListZ.get(j);
                                if (school.getScode().equals(plan.getSchoolCode())) {
                                    existFlag = true;
                                    break;
                                }
                            }
                            if (!existFlag) {
                                School school = new School();
                                school.setScode(plan.getSchoolCode());
                                schoolListZ.add(school);
                            }
                        }

                        if (cha > 0 && cha <= 30) {
                            boolean existFlag = false;
                            for (int j = 0; j < schoolListW.size(); j++) {
                                School school = schoolListW.get(j);
                                if (school.getScode().equals(plan.getSchoolCode())) {
                                    existFlag = true;
                                    break;
                                }
                            }
                            if (!existFlag) {
                                School school = new School();
                                school.setScode(plan.getSchoolCode());
                                schoolListW.add(school);
                            }
                        }

                        if (cha > 30 && cha <= 70) {
                            boolean existFlag = false;
                            for (int j = 0; j < schoolListS.size(); j++) {
                                School school = schoolListS.get(j);
                                if (school.getScode().equals(plan.getSchoolCode())) {
                                    existFlag = true;
                                    break;
                                }
                            }
                            if (!existFlag) {
                                School school = new School();
                                school.setScode(plan.getSchoolCode());
                                schoolListS.add(school);
                            }
                        }

                        if (cha > 70) {
                            boolean existFlag = false;
                            for (int j = 0; j < schoolListB.size(); j++) {
                                School school = schoolListB.get(j);
                                if (school.getScode().equals(plan.getSchoolCode())) {
                                    existFlag = true;
                                    break;
                                }
                            }
                            if (!existFlag) {
                                School school = new School();
                                school.setScode(plan.getSchoolCode());
                                schoolListB.add(school);
                            }
                        }
                    }
                }

				Map map = new HashMap();
				map.put("all",schoolListAll.size());
                map.put("z",schoolListZ.size());
				map.put("c",schoolListC.size());
				map.put("w",schoolListW.size());
				map.put("s",schoolListS.size());
				map.put("b",schoolListB.size());
				return AjaxResult.success(map);
			}else{
				return AjaxResult.error("请填写首选科目和高考成绩");
			}
		}else {

			return AjaxResult.error("会员信息不存在，请先注册成为会员");
		}


	}

	@ApiOperation("会员登录")
	@GetMapping("/loginMemberByPhone")
	public AjaxResult loginMemberByPhone(String phone) {


		System.out.println("-------------loginMemberByPhone--------------"+phone);

		if(isSpecialChar(phone.toString())||sqlValidate(phone.toString())){
			AjaxResult.error("参数包含非法字符");
		}

		BuzMember memberQuery=new BuzMember();
		memberQuery.setPhone(phone);
		List<BuzMember> memberList=buzMemberService.selectBuzMemberList(memberQuery);

		if(memberList!=null&&memberList.size()>0) {
			return AjaxResult.success(memberList.get(0));
		}else {
			//如果会员信息不存在，自动创建会员


			memberQuery.setPhone(phone);

			memberQuery.setPwd("985211");
			memberQuery.setGrade(588);
			memberQuery.setSxkm("物理");
			memberQuery.setZxkm("化学,生物");
			memberQuery.setSfssmz(0);
			memberQuery.setSfgjzxdfzx(0);
			memberQuery.setSfvip(0);
			memberQuery.setYear(2024);
			memberQuery.setQggrade(588);
			memberQuery.setGxgrade(588);
			memberQuery.setSfdfzx(0);
			memberQuery.setUserType(1);
			memberQuery.setId(IdUtil.getSnowflakeNextIdStr());

            buzMemberService.insertBuzMember(memberQuery);

			return AjaxResult.success(memberQuery);
		}


	}
    
    
    /**
	 * 验证手机号码、短信是否正确公共方法
	 *
	 * @param mobileCode
	 * @param phone
	 * @return Map
	 */
	public Map checkMobileCode(String phone, String mobileCode) {

		Map map = new HashMap();
		if (phone == null || phone.equals("") || phone.length() != 11 ) {
			map.put("status", "1");
			map.put("msg", "手机号码为空或手机格式错误");

		} else if (mobileCode == null || mobileCode.contentEquals("")) {
			map.put("status", "1");
			map.put("msg", "验证码为空");
		} else {
			YxSms sms = new YxSms();
			sms.setMobile(phone);
			sms.setCode(mobileCode);
			sms.setBeginTime(StringDate.getTime());
			if ( ("13718997248".equals(phone)&&"997248".equals(mobileCode)) ) {
				YxSms tsms = new YxSms();
				tsms.setMobile(phone);
				tsms.setCode("123456");
				List tsmsList = new ArrayList();
				tsmsList.add(tsms);

				map.put("status", "0");
				map.put("msg", "验证成功");
				map.put("list", tsmsList);

			} else {
				List<YxSms> tsms = tSmsService.selectTSmsLists(sms);
				if (tsms != null && tsms.size() > 0) {
					map.put("status", "0");
					map.put("msg", "验证成功");
					map.put("list", tsms);
				} else {
					map.put("status", "1");
					map.put("msg", "手机号码或验证码错误");
				}
			}
		}
		return map;
	}
    
    @ApiOperation("发送短信")
    @GetMapping("/sendSms")
    public AjaxResult sendSms(String mobile,String from) {
        String phone = mobile;
        if (phone == null || phone.equals("") || phone.length() != 11
               ) {
            if (phone == null || phone.equals("") || phone.length() != 11) {
                return AjaxResult.error("手机号码为空或手机号格式不正确");
            } else {
                return AjaxResult.error("IP地址为空");
            }
        } else {
        	
        	
        	if(isSpecialChar(phone.toString())||sqlValidate(phone.toString())){
        		AjaxResult.error("参数包含非法字符");
        	}
        	
            /**
             * 1.查询该IP地址在30秒内发起短信验证次数是否超过6次（查表sys_oper_log），如果超过6次，则禁止。防止别人防止恶意刷手机验证码短信
             * 2.查询该手机号码在有效时间范围内是否有短信验证码记录（查表t_sms）。如果没有，则发送短信，并记录到表t_sms中。如果有记录，则判断发送短信时间是否超过1分钟。
             * 如果超过，则重新发送短信验证码。否则不发送验证码。
             */


            YxSms sms = new YxSms();
            sms.setMobile(phone);
            sms.setBeginTime(StringDate.getTime());
            List<YxSms> tsms = tSmsService.selectTSmsLists(sms);
            if (tsms != null && tsms.size() > 0) {
                try {
                    String nowTimeString = StringDate.getTime();
                    String beginTime = tsms.get(0).getBeginTime();
                    long cha = StringDate.getCompareDateMinu(beginTime, nowTimeString);
                    if (cha >= 1) {
                        // 间隔时间超过1分钟，发短信
                        sms = tsms.get(0);
                        String code = String.valueOf(sms.getCode());

                        //短信验证码
                        
                        
                        /*
                         * 
                         */
                        sendSmsDemo.sendSms(phone, code);
                        /*
                        if("dny".equals(from)) {
                        	sendSmsDemo.sendSms(phone, code);
                        }else if("szy".equals(from)) {
                        	sendSmsSzy.sendSms(phone, code);
                        }

                         */
                        
                        /*
                        List<String> phoneNumberList = new ArrayList<>();  // 接收人电话列表
                        phoneNumberList.add(mobile);
                        List<String> signNameList = new ArrayList<>();  // 签名列表
                        signNameList.add(SmsConstant.SIGN_NAME);
                        List<String> templateParamList = new ArrayList<>();  // 模板参数列表
                        templateParamList.add(SmsConstant.VCODE_TEMPLATE_CODE);
                        
                      //发送短信
                        SendReq sendReq = new SendReq();
                        sendReq.setProviderCode(SendProvider.ALI_SMS.getCode());  // 设置发送短信厂商
                        sendReq.setTemplateCode(SmsConstant.VCODE_TEMPLATE_CODE); // 短信模板编号
                        sendReq.setSmType("1"); // 短信类型：模板短信
                        sendReq.setPhoneNumberList(phoneNumberList);
                        sendReq.setSignNameList(signNameList);
                        sendReq.setTemplateParamList(templateParamList);
                        sendReq.setContent(code);
                        SmsResponse response = smsManager.sendChoose(sendReq);
                        */
                        
                        
                        
                        //sendSmsDemo.sendSms(phone, code);
                        //smsSender.batchSendMsg(mobile, new Integer(code).toString());
                    } else {
                        return AjaxResult.error("当前操作太频繁，请稍后再试！！！");
                    }
                } catch (ParseException e) {
                    e.printStackTrace();
                }
            } else {
                // 发短信

                int code = (int) ((Math.random() * 9 + 1) * 100000);
                String Code = String.valueOf(code);
                //短信验证码
                //sendSmsDemo.sendSms(phone, new Integer(code).toString());
                /**京东云短信接口代码**/
                //smsSender.batchSendMsg(mobile, new Integer(code).toString());

                sendSmsDemo.sendSms(phone, Code);

                /*
                if("dny".equals(from)) {
                	sendSmsDemo.sendSms(phone, Code);
                }else if("szy".equals(from)) {
                	sendSmsSzy.sendSms(phone, Code);
                }

                 */
                
                /*
                List<String> phoneNumberList = new ArrayList<>();  // 接收人电话列表
                phoneNumberList.add(mobile);
                List<String> signNameList = new ArrayList<>();  // 签名列表
                signNameList.add(SmsConstant.SIGN_NAME);
                List<String> templateParamList = new ArrayList<>();  // 模板参数列表
                templateParamList.add(SmsConstant.VCODE_TEMPLATE_CODE);
                
              //发送短信
                SendReq sendReq = new SendReq();
                sendReq.setProviderCode(SendProvider.ALI_SMS.getCode());  // 设置发送短信厂商
                sendReq.setTemplateCode(SmsConstant.VCODE_TEMPLATE_CODE); // 短信模板编号
                sendReq.setSmType("1"); // 短信类型：模板短信
                sendReq.setPhoneNumberList(phoneNumberList);
                sendReq.setSignNameList(signNameList);
                sendReq.setTemplateParamList(templateParamList);
                sendReq.setContent(Code);
                SmsResponse response = smsManager.sendChoose(sendReq);
                */
                

//				smsSender.sendSms(mobile, new Integer(code).toString());
                Calendar cal = Calendar.getInstance();
                cal.setTime(new Date());
                cal.add(Calendar.MINUTE, 15);// 24小时制
                YxSms sms1 = new YxSms();
                sms1.setBeginTime(StringDate.getTime());
                sms1.setEndTime(StringDate.getTime4(cal.getTime()));
                sms1.setCode(Code);
                sms1.setMobile(phone);
                tSmsService.insertYxSms(sms1);
                return AjaxResult.success("短信发送成功");
            }

        }

        return AjaxResult.success("短信发送成功");

    }
    
    
    /************
     * 
     * @param schoolCode
     * @param userId
     * @return
     * 返回内容为：
     * 1个school对象
     * 1个专业组数组
     * 第一个专业组的投档概率（3条记录）
     * 第一个专业组下个专业的投档概率（每个专业3条记录）
     */
    @ApiOperation("录取分数详情详情")
    @GetMapping("/showAdmission")
    public AjaxResult showAdmission(String schoolCode,String majorCode,Integer year,String userId)
    {

    	
    	if(userId==null||userId.equals("")) {
    		return AjaxResult.error("请先登录");
    	}
    	
    	if(isSpecialChar(userId.toString())||sqlValidate(userId.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	BuzMember memberQuery=buzMemberService.selectBuzMemberById(userId);

    	
    	
    	if(schoolCode==null||schoolCode.trim().equals("")) {
    		
    		return AjaxResult.error("请选择学校");
    	}
    	
    	if(isSpecialChar(schoolCode.toString())||sqlValidate(schoolCode.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	if(majorCode==null||majorCode.trim().equals("")) {
    		
    		return AjaxResult.error("请选择专业");
    	}
    	
    	//根据专业编码查询专业名称
    	SMajors sMajorsQuery=new SMajors();
    	sMajorsQuery.setMcode(majorCode);
    	List<SMajors> sMajorsList=sMajorsService.selectSMajorsList(sMajorsQuery);
    	if(sMajorsList!=null&&sMajorsList.size()>0) {
    		sMajorsQuery=sMajorsList.get(0);
    	}
    	
    	if(isSpecialChar(majorCode.toString())||sqlValidate(majorCode.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	
    	if(year==null) return AjaxResult.error("请选择年份");
    	
    	SchoolMajorYearAdmissionDetail schoolMajorYearAdmissionDetail=new SchoolMajorYearAdmissionDetail();
    	schoolMajorYearAdmissionDetail.setsCode(schoolCode);
    	schoolMajorYearAdmissionDetail.setMajor(sMajorsQuery.getMname());
    	schoolMajorYearAdmissionDetail.setYear(year);
    	
    	if("物理".equals(memberQuery.getSxkm())) {
    		schoolMajorYearAdmissionDetail.setMajorType("理工类");
    	}
    	if("历史".equals(memberQuery.getSxkm())) {
    		schoolMajorYearAdmissionDetail.setMajorType("文史类");
    	}
    	
    	List<SchoolMajorYearAdmissionDetail> list=schoolMajorYearAdmissionDetailService.selectSchoolMajorYearAdmissionDetailList(schoolMajorYearAdmissionDetail);
    	
        return AjaxResult.success(list);
    }
    
    /************
     * 
     * @param schoolCode
     * @param userId
     * @return
     * 返回内容为：
     * 1个school对象
     * 1个专业组数组
     * 第一个专业组的投档概率（3条记录）
     * 第一个专业组下个专业的投档概率（每个专业3条记录）
     */
    @ApiOperation("添加收藏夹")
    @GetMapping("/addMyFavorite")
    public AjaxResult addMyFavorite(String schoolCode,String zyz,String majorCode,String userId)
    {
    	if(userId==null||userId.equals("")) {
    		return AjaxResult.error("请先登录");
    	}
    	
    	if(isSpecialChar(userId.toString())||sqlValidate(userId.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	BuzMember memberQuery=buzMemberService.selectBuzMemberById(userId);

    	if(memberQuery==null||memberQuery.getId().equals("")) {
    		return AjaxResult.error("未注册成为会员，请先注册");
    	}
    	
    	
    	MyFavorite myFavorite=new MyFavorite();
    	myFavorite.setUserId(userId);
    	
    	if(schoolCode==null||schoolCode.trim().equals("")) {
    		
    		return AjaxResult.error("请选择学校");
    	}
    	
    	if(isSpecialChar(schoolCode.toString())||sqlValidate(schoolCode.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	myFavorite.setSchoolCode(schoolCode);
    	
    	if(zyz==null||zyz.trim().equals("")) {
    		
    		return AjaxResult.error("请选择专业组");
    	}
    	
    	if(isSpecialChar(zyz.toString())||sqlValidate(zyz.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	myFavorite.setZyz(zyz);
    	
    	if(majorCode!=null&&!majorCode.trim().equals("")) {
    		if(isSpecialChar(majorCode.toString())||sqlValidate(majorCode.toString())){
        		AjaxResult.error("参数包含非法字符");
        	}
    		
    		myFavorite.setMajorCode(majorCode);
    		
    		//根据专业编码查询专业名称
        	SMajors sMajorsQuery=new SMajors();
        	sMajorsQuery.setMcode(majorCode);
        	List<SMajors> sMajorsList=sMajorsService.selectSMajorsList(sMajorsQuery);
        	if(sMajorsList!=null&&sMajorsList.size()>0) {
        		sMajorsQuery=sMajorsList.get(0);
        		
        		myFavorite.setMajorName(sMajorsQuery.getMname());
        	}
    	}
    	
    	List<MyFavorite> list=myFavoriteService.selectMyFavoriteList(myFavorite);
    	if(list==null||list.size()==0) {
    		myFavoriteService.insertMyFavorite(myFavorite);
    	}
    	
    	
    	return AjaxResult.success();
    	
    }

    
    @ApiOperation("查询我的收藏夹")
    @GetMapping("/queryMyFavorite")
    public AjaxResult queryMyFavorite(String userId)
    {
    	if(userId==null||userId.equals("")) {
    		return AjaxResult.error("请先登录");
    	}
    	
    	if(isSpecialChar(userId.toString())||sqlValidate(userId.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	MyFavorite myFavorite=new MyFavorite();
    	myFavorite.setUserId(userId);
    	List<MyFavorite> list=myFavoriteService.selectMyFavoriteList(myFavorite);
    	return AjaxResult.success(list);
    }
    
    @ApiOperation("删除我的收藏夹")
    @GetMapping("/deleteMyFavorite")
    public AjaxResult deleteMyFavorite(String userId,Long id)
    {
    	if(userId==null||userId.equals("")) {
    		return AjaxResult.error("请先登录");
    	}
    	
    	if(isSpecialChar(userId.toString())||sqlValidate(userId.toString())){
    		AjaxResult.error("参数包含非法字符");
    	}
    	
    	BuzMember memberQuery=buzMemberService.selectBuzMemberById(userId);

    	if(memberQuery==null||memberQuery.getId().equals("")) {
    		return AjaxResult.error("未注册成为会员，请先注册");
    	}
    	
    	MyFavorite myFavorite=new MyFavorite();
    	myFavorite.setUserId(userId);
    	myFavorite.setId(id);
    	myFavoriteService.deleteMyFavoriteByIdAndUserId(myFavorite);
    	return AjaxResult.success();
    }

    @ApiOperation("添加用户偏好设置")
    @GetMapping("/addMemberSetting")
    public AjaxResult addMemberSetting(String userId,String stype,String scode)
    {
        if(userId==null||userId.equals("")) {
            return AjaxResult.error("请先登录");
        }

        if(isSpecialChar(userId.toString())||sqlValidate(userId.toString())){
            AjaxResult.error("参数包含非法字符");
        }

        BuzMember memberQuery=buzMemberService.selectBuzMemberById(userId);

        if(memberQuery==null||memberQuery.getId().equals("")) {
            return AjaxResult.error("未注册成为会员，请先注册");
        }

        if(stype==null||stype.equals("")) {
            return AjaxResult.error("请选择偏好类型");
        }

        if(isSpecialChar(stype)||sqlValidate(stype)){
            AjaxResult.error("参数包含非法字符");
        }

        if(scode==null||scode.equals("")) {
            return AjaxResult.error("请选择偏好");
        }

        if(isSpecialChar(scode)||sqlValidate(scode)){
            AjaxResult.error("参数包含非法字符");
        }

        List<School> schoolList=null;
        List<SchoolPlan> plans2024List =null;
        List<BaseArea> proviceList=null;
        if(stype.equals("school")){
            schoolList=schoolService.selectSchoolList(null);
        }
        if(stype.equals("major")){
			if(memberQuery.getSxkm()!=null&&memberQuery.getGrade()!=null) {
				SchoolPlan schoolPlanQuery = new SchoolPlan();
				schoolPlanQuery.setYear(thisYear);
				if ("物理".equals(memberQuery.getSxkm())) {
					schoolPlanQuery.setMajorType("理工类");
				}
				if ("历史".equals(memberQuery.getSxkm())) {
					schoolPlanQuery.setMajorType("文史类");
				}
				schoolPlanQuery.setMajorPlan(memberQuery.getGrade());
				plans2024List = schoolPlanService.selectSchoolMajorPlanList(schoolPlanQuery);
			}
        }
        if(stype.equals("province")){
            proviceList=baseAreaService.selectChildrenList(null);
        }

        List<GkMemberSetting> settingList=new ArrayList();
        String[] scodeArr=scode.split(",");
        for(int i=0;i<scodeArr.length;i++){
            String code=scodeArr[i];

            GkMemberSetting setting=new GkMemberSetting();
            setting.setMemberId(memberQuery.getId());
            setting.setStype(stype);
            setting.setScode(code);

            if(stype.equals("school")){
                if(schoolList!=null){
                    for(int j=0;j<schoolList.size();j++){
                        School shool=schoolList.get(j);
                        if(shool.getScode().equals(code)){
                            setting.setSname(shool.getSname());
                            break;
                        }
                    }
                }
            }

            if(stype.equals("major")){
                if(plans2024List!=null) {
                    for (int j = 0; j < plans2024List.size(); j++) {
						SchoolPlan majors=plans2024List.get(j);
                        if(majors.getMajorName().equals(code)){
                            setting.setSname(majors.getMajorName());
                            setting.setScode(majors.getMajorCode());
                            break;
                        }
                    }
                }
            }

            if(stype.equals("province")){
                if(proviceList!=null) {
                    for (int j = 0; j < proviceList.size(); j++) {
                        BaseArea province=proviceList.get(j);
						//System.out.println("-----province.getId()----"+province.getId()+"-----code--"+code);
                        if(province.getId().toString().equals(code)){
							System.out.println("-----province.getName()----"+province.getName());
                            setting.setSname(province.getName());
                            break;
                        }
                    }
                }
				System.out.println("---------setting.getSname()-------"+setting.getSname());
            }

            settingList.add(setting);

        }

        gkMemberSettingService.insertGkMemberSettingList(settingList);



        return AjaxResult.success();
    }

	@ApiOperation("保存用户偏好设置")
	@GetMapping("/saveMemberSetting")
	public AjaxResult saveMemberSetting(String userId,String stype,String scode)
	{
		if(userId==null||userId.equals("")) {
			return AjaxResult.error("请先登录");
		}

		if(isSpecialChar(userId.toString())||sqlValidate(userId.toString())){
			AjaxResult.error("参数包含非法字符");
		}

		BuzMember memberQuery=buzMemberService.selectBuzMemberById(userId);

		if(memberQuery==null||memberQuery.getId().equals("")) {
			return AjaxResult.error("未注册成为会员，请先注册");
		}

		if(stype==null||stype.equals("")) {
			return AjaxResult.error("请选择偏好类型");
		}

		if(isSpecialChar(stype)||sqlValidate(stype)){
			AjaxResult.error("参数包含非法字符");
		}

		if(scode==null||scode.equals("")) {
			return AjaxResult.error("请选择偏好");
		}

		if(isSpecialChar(scode)||sqlValidate(scode)){
			AjaxResult.error("参数包含非法字符");
		}

		List<School> schoolList=null;
		List<SchoolPlan> plans2024List =null;
		List<BaseArea> proviceList=null;
		if(stype.equals("school")){
			schoolList=schoolService.selectSchoolList(null);
		}
		if(stype.equals("major")){
			GkMemberSetting setting=new GkMemberSetting();
			setting.setStype(stype);
			setting.setMemberId(userId);
			gkMemberSettingService.deleteGkMemberSettingByCodes(setting);


			if(memberQuery.getSxkm()!=null&&memberQuery.getGrade()!=null) {
				SchoolPlan schoolPlanQuery = new SchoolPlan();
				schoolPlanQuery.setYear(thisYear);
				if ("物理".equals(memberQuery.getSxkm())) {
					schoolPlanQuery.setMajorType("理工类");
				}
				if ("历史".equals(memberQuery.getSxkm())) {
					schoolPlanQuery.setMajorType("文史类");
				}
				schoolPlanQuery.setMajorPlan(memberQuery.getGrade());
				plans2024List = schoolPlanService.selectSchoolMajorPlanList(schoolPlanQuery);
			}
		}
		if(stype.equals("province")){
			GkMemberSetting setting=new GkMemberSetting();
			setting.setStype(stype);
			setting.setMemberId(userId);
			gkMemberSettingService.deleteGkMemberSettingByCodes(setting);

			proviceList=baseAreaService.selectChildrenList(null);
		}

		List<GkMemberSetting> settingList=new ArrayList();
		String[] scodeArr=scode.split(",");
		for(int i=0;i<scodeArr.length;i++){
			String code=scodeArr[i];

			GkMemberSetting setting=new GkMemberSetting();
			setting.setMemberId(memberQuery.getId());
			setting.setStype(stype);
			setting.setScode(code);

			if(stype.equals("school")){
				if(schoolList!=null){
					for(int j=0;j<schoolList.size();j++){
						School shool=schoolList.get(j);
						if(shool.getScode().equals(code)){
							setting.setSname(shool.getSname());
							break;
						}
					}
				}
			}

			if(stype.equals("major")){
				if(plans2024List!=null) {
					for (int j = 0; j < plans2024List.size(); j++) {
						SchoolPlan majors=plans2024List.get(j);
						if(majors.getMajorName().equals(code)){
							setting.setSname(majors.getMajorName());
							setting.setScode(majors.getMajorCode());
							break;
						}
					}
				}
			}

			if(stype.equals("province")){
				if(proviceList!=null) {
					for (int j = 0; j < proviceList.size(); j++) {
						BaseArea province=proviceList.get(j);
						//System.out.println("-----province.getId()----"+province.getId()+"-----code--"+code);
						if(province.getId().toString().equals(code)){
							System.out.println("-----province.getName()----"+province.getName());
							setting.setSname(province.getName());
							break;
						}
					}
				}
				System.out.println("---------setting.getSname()-------"+setting.getSname());
			}

			settingList.add(setting);

		}

		gkMemberSettingService.insertGkMemberSettingList(settingList);



		return AjaxResult.success();
	}

    @ApiOperation("删除用户偏好设置")
    @GetMapping("/delMemberSetting")
    public AjaxResult delMemberSetting(String userId,String stype,String scode)
    {
        if(userId==null||userId.equals("")) {
            return AjaxResult.error("请先登录");
        }

        if(isSpecialChar(userId.toString())||sqlValidate(userId.toString())){
            AjaxResult.error("参数包含非法字符");
        }

        BuzMember memberQuery=buzMemberService.selectBuzMemberById(userId);

        if(memberQuery==null||memberQuery.getId().equals("")) {
            return AjaxResult.error("未注册成为会员，请先注册");
        }

        if(stype==null||stype.equals("")) {
            return AjaxResult.error("请选择偏好类型");
        }

        if(isSpecialChar(stype)||sqlValidate(stype)){
            AjaxResult.error("参数包含非法字符");
        }

        if(scode==null||scode.equals("")) {
            return AjaxResult.error("请选择偏好");
        }

        if(isSpecialChar(scode)||sqlValidate(scode)){
            AjaxResult.error("参数包含非法字符");
        }



        String codeStr="";
        String[] scodeArr=scode.split(",");
        for(int i=0;i<scodeArr.length;i++){
            String code=scodeArr[i];
            if(code!=null&&!code.equals("")) {
                codeStr = codeStr + "'" + code + "',";
            }
        }
        if(!codeStr.equals("")){
            codeStr=codeStr.substring(0,codeStr.length()-1);
			GkMemberSetting setting=new GkMemberSetting();
			setting.setScode(codeStr);
			setting.setMemberId(userId);
            gkMemberSettingService.deleteGkMemberSettingByCodes(setting);
        }


        GkMemberSetting setting=new GkMemberSetting();
        setting.setMemberId(userId);
        List<GkMemberSetting> list=gkMemberSettingService.selectGkMemberSettingList(setting);
        return AjaxResult.success(list);
    }

    @ApiOperation("查询我的偏好")
    @GetMapping("/queryMemberSetting")
    public AjaxResult queryMemberSetting(String userId)
    {
        if(userId==null||userId.equals("")) {
            return AjaxResult.error("请先登录");
        }

        if(isSpecialChar(userId.toString())||sqlValidate(userId.toString())){
            AjaxResult.error("参数包含非法字符");
        }

        GkMemberSetting setting=new GkMemberSetting();
        setting.setMemberId(userId);
        List<GkMemberSetting> list=gkMemberSettingService.selectGkMemberSettingList(setting);
        return AjaxResult.success(list);
    }

	/*
    @ApiOperation("updateSchoolPlan")
    @GetMapping("/updateSchoolPlan")
    public AjaxResult updateSchoolPlan(String majorType)
    {
        SchoolPlan plan2023=new SchoolPlan();
        plan2023.setYear(2023);
        plan2023.setMajorType(majorType);
        plan2023.setZyz("123");
        //plan2023.setSchoolCode("12710");
        List<SchoolPlan> list2023=schoolPlanService.selectSchoolPlanList2(plan2023);

        SchoolPlan plan2024=new SchoolPlan();
        plan2024.setYear(2024);
        plan2024.setMajorType(majorType);
        //plan2023.setSchoolCode("12710");
        List<SchoolPlan> list2024=schoolPlanService.selectSchoolPlanList2(plan2024);

        List<SchoolPlan> updateList=new ArrayList();
        for(int i=0;i<list2023.size();i++){
            SchoolPlan p2023=list2023.get(i);
            String schoolCode=p2023.getSchoolCode();
            String majorCode=p2023.getMajorName();

            for(int j=0;j<list2024.size();j++){
                SchoolPlan p2024=list2024.get(j);
                String schoolCode2=p2024.getSchoolCode();
                String majorCode2=p2024.getMajorName();
                String zyz=p2024.getZyz();

                if(schoolCode.equals(schoolCode2)&&majorCode.equals(majorCode2)){
                    p2023.setZyz(zyz);
                    System.out.println("------------zyz--------------"+zyz);
                    break;
                }
            }
            updateList.add(p2023);
            if(updateList.size()>1000){
                schoolPlanService.updateSchoolPlanZyzList(updateList);
                updateList.clear();
            }
        }
        if(updateList.size()>0){
            schoolPlanService.updateSchoolPlanZyzList(updateList);
        }


        return AjaxResult.success();
    }

	 */

    @ApiOperation("从school_major_year_admission补充数据至plan")
    @GetMapping("/updateSchoolPlanFromAdmission2023")
    public AjaxResult updateSchoolPlanFromAdmission2023(String majorType)
    {



        List<SchoolPlan> addList=new ArrayList();


        List<SchoolMajorYearAdmission> admissonList2023= schoolMajorYearAdmissionService.selectSchoolMajorYearAdmission2023List(null);

        List<SchoolPlan> list2023=schoolPlanService.fix2023PlanList(null);
        for(int i=0;i<list2023.size();i++){
            SchoolPlan p2023=list2023.get(i);

            SchoolPlan p=new SchoolPlan();
            p.setYear(2023);
            p.setMajorType("文史类");
            p.setZyz(p2023.getZyz());
            p.setSchoolCode(p2023.getSchoolCode());
            p.setSchoolName(p2023.getSchoolName());

            p.setMajorCode(p2023.getMajorCode());
            p.setMajorName(p2023.getMajorName());
            p.setMajorSeq(p2023.getMajorSeq());

            p.setKm1(p2023.getKm1());
            p.setKm2(p2023.getKm2());
            p.setBatch("本科普通批");
            p.setKm21(p2023.getKm21());
            p.setKm22(p2023.getKm22());
            p.setKm23(p2023.getKm23());
            p.setMajorPm(p2023.getMajorPm());

            for(int j=0;j<admissonList2023.size();j++){
                SchoolMajorYearAdmission admission=admissonList2023.get(j);
                if(admission.getsCode().equals(p.getSchoolCode())&&admission.getMajorCode().equals(p.getMajorCode())){
                    //p.setSchoolPlan();
                    p.setMajorPlan(admission.getPlan());

                    addList.add(p);
                }
            }



        }

        if(addList.size()>0) {

            schoolPlanService.insertSchoolPlanAllList(addList);
        }



        return AjaxResult.success();
    }


    @ApiOperation("从更新专业录取数，录取最低分，录取平均分")
    @GetMapping("/updateSchoolPlanAdmissionLow")
    public AjaxResult updateSchoolPlanAdmissionLow(String majorType,Integer year)
    {

        SchoolPlan schoolPlanQuery=new SchoolPlan();
        schoolPlanQuery.setYear(year);
        schoolPlanQuery.setMajorType(majorType);
        List<SchoolPlan> list2023=schoolPlanService.selectLowGradePlanList(schoolPlanQuery);






        //广西排位分
        GkGradeDoc gkGradeDoc=new GkGradeDoc();
        gkGradeDoc.setYear(year);
        if("理工类".equals(majorType)) {
            gkGradeDoc.setGradeClass("工类");
        }
        if("文史类".equals(majorType)) {
            gkGradeDoc.setGradeClass("史类");
        }
        gkGradeDoc.setUseIn("广西");
        List<GkGradeDoc> gradeList=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);


        //全国认可加分排位分
        gkGradeDoc=new GkGradeDoc();
        gkGradeDoc.setYear(year);
        if("理工类".equals(majorType)) {
            gkGradeDoc.setGradeClass("工类");
        }
        if("文史类".equals(majorType)) {
            gkGradeDoc.setGradeClass("史类");
        }
        gkGradeDoc.setUseIn("全国");
        List<GkGradeDoc> gradeList2=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);



        List<SchoolPlan> addList=new ArrayList();


        for(int i=0;i<list2023.size();i++){
            SchoolPlan p2023=list2023.get(i);

            Integer low=p2023.getMajorLowGrade();
            Integer avg=p2023.getMajorAvgGrade();

            String privince=p2023.getSprovince();
            System.out.println("------------------privince-------"+privince);
            if("450000".equals(privince)){//广西院校，用广西排名
                for(int j=0;j<gradeList.size();j++){
                    GkGradeDoc gradeDoc=gradeList.get(j);
                    if(gradeDoc.getGrade().intValue()==low.intValue()){
                        p2023.setMajorLowPm(gradeDoc.getSeq());
                    }
                    if(gradeDoc.getGrade().intValue()==avg.intValue()){
                        p2023.setMajorAvgPm(gradeDoc.getSeq());
                    }
                }
            }else{//非广西院校，用全国排名
                for(int j=0;j<gradeList2.size();j++){
                    GkGradeDoc gradeDoc=gradeList2.get(j);
                    if(gradeDoc.getGrade().intValue()==low.intValue()){
                        p2023.setMajorLowPm(gradeDoc.getSeq());
                    }
                    if(gradeDoc.getGrade().intValue()==avg.intValue()){
                        p2023.setMajorAvgPm(gradeDoc.getSeq());
                    }
                }
            }

            addList.add(p2023);
            if(addList.size()==1000){
                schoolPlanService.updateSchoolPlanMajorLowList(addList);
                addList.clear();
            }


        }

        if(addList.size()>0) {

            schoolPlanService.updateSchoolPlanMajorLowList(addList);
        }



        return AjaxResult.success();
    }

    @ApiOperation("从考试指南新增2022/2021年的招生计划")
    @GetMapping("/addSchoolPlanAdmissionLow")
    public AjaxResult addSchoolPlanAdmissionLow(String majorType,Integer year,String schoolCode1,String zyz1)
    {


        SchoolMajorYearAdmission majorYearAdmissionQuery=new SchoolMajorYearAdmission();
        majorYearAdmissionQuery.setYear(year);
        majorYearAdmissionQuery.setMajorType(majorType);
		majorYearAdmissionQuery.setsCode(schoolCode1);
        majorYearAdmissionQuery.setZyz(zyz1);
        List<SchoolMajorYearAdmission> admissonList2023= schoolMajorYearAdmissionService.selectSchoolMajorYearAdmission2022List(majorYearAdmissionQuery);



        SchoolPlan schoolPlanQuery=new SchoolPlan();
        schoolPlanQuery.setYear(2025);
        schoolPlanQuery.setMajorType(majorType);
        List<SchoolPlan> list2024=schoolPlanService.selectSchoolPlanList2(schoolPlanQuery);






        //广西排位分
        GkGradeDoc gkGradeDoc=new GkGradeDoc();
        gkGradeDoc.setYear(year);
        if("理工类".equals(majorType)) {
            gkGradeDoc.setGradeClass("工类");
        }
        if("文史类".equals(majorType)) {
            gkGradeDoc.setGradeClass("史类");
        }
        gkGradeDoc.setUseIn("广西");
        List<GkGradeDoc> gradeList=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);


        //全国认可加分排位分
        gkGradeDoc=new GkGradeDoc();
        gkGradeDoc.setYear(year);
        if("理工类".equals(majorType)) {
            gkGradeDoc.setGradeClass("工类");
        }
        if("文史类".equals(majorType)) {
            gkGradeDoc.setGradeClass("史类");
        }
        gkGradeDoc.setUseIn("全国");
        List<GkGradeDoc> gradeList2=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);



        List<SchoolPlan> addList=new ArrayList();


        for(int i=0;i<admissonList2023.size();i++){


            SchoolMajorYearAdmission admin2023=admissonList2023.get(i);
            String schoolCode=admin2023.getsCode();
            String major=admin2023.getMajor();
			String majorCode=admin2023.getMajorCode();
			String zyz=admin2023.getZyz();

            for(int k=0;k<list2024.size();k++) {

                SchoolPlan p2023=list2024.get(k);
                String schoolCode2=p2023.getSchoolCode();
                String majorName2=p2023.getMajorName();
				String majorCode2=p2023.getMajorCode();
				String zyz2=p2023.getZyz();

				boolean flag=false;
				if(schoolCode.equals(schoolCode2)&&major.equals(majorName2)&&zyz2.equals(zyz)){
					flag=true;
				}
                if(schoolCode.equals(schoolCode2)&&majorCode.equals(majorCode2)&&zyz2.equals(zyz)){
                    flag=true;
                }

                if(flag){

                    SchoolPlan p=new SchoolPlan();
                    p.setYear(year);
                    p.setMajorType(majorType);

                    p.setZyz(p2023.getZyz());
                    p.setSchoolCode(p2023.getSchoolCode());
                    p.setSchoolName(p2023.getSchoolName());

                    p.setMajorCode(p2023.getMajorCode());
                    p.setMajorName(p2023.getMajorName());
                    p.setMajorSeq(p2023.getMajorSeq());

                    p.setKm1(p2023.getKm1());
                    p.setKm2(p2023.getKm2());
                    p.setBatch("本科普通批");
                    p.setKm21(p2023.getKm21());
                    p.setKm22(p2023.getKm22());
                    p.setKm23(p2023.getKm23());
                    p.setMajorPm(p2023.getMajorPm());

                    p.setMajorAdmin(admin2023.getAdmission());
                    p.setMajorPlan(admin2023.getPlan());
                    p.setMajorLowGrade(admin2023.getLowGrade());
                    p.setMajorAvgGrade(admin2023.getAvgGrade());
                    p.setMajorPm(p2023.getMajorPm());
					p.setMajorLowPm(admin2023.getLowGradeSeq());

                    Integer low = admin2023.getLowGrade();
                    if(low==null) low=0;
                    Integer avg = admin2023.getAvgGrade();
                    if(avg==null) avg=0;

                    String privince = admin2023.getZxkm();
                    System.out.println("------------------privince-------" + privince);
                    if ("450000".equals(privince)) {//广西院校，用广西排名
                        for (int j = 0; j < gradeList.size(); j++) {
                            GkGradeDoc gradeDoc = gradeList.get(j);
                            if (gradeDoc.getGrade().intValue() == low.intValue()) {
                               // p.setMajorLowPm(gradeDoc.getSeq());
                            }
                            if (gradeDoc.getGrade().intValue() == avg.intValue()) {
                                p.setMajorAvgPm(gradeDoc.getSeq());
                            }
                        }
                    } else {//非广西院校，用全国排名
                        for (int j = 0; j < gradeList2.size(); j++) {
                            GkGradeDoc gradeDoc = gradeList2.get(j);
                            if (gradeDoc.getGrade().intValue() == low.intValue()) {
                              //  p.setMajorLowPm(gradeDoc.getSeq());
                            }
                            if (gradeDoc.getGrade().intValue() == avg.intValue()) {
                                p.setMajorAvgPm(gradeDoc.getSeq());
                            }
                        }
                    }

                    addList.add(p);
                    break;

                }


                if (addList.size() == 1000) {
                    schoolPlanService.insertSchoolPlanAllList2(addList);
                    addList.clear();
                }
            }


        }

        if(addList.size()>0) {

            schoolPlanService.insertSchoolPlanAllList2(addList);
        }



        return AjaxResult.success();
    }

    @ApiOperation("更新zyzPlan")
    @GetMapping("/addSchoolPlanZyzPlan")
    public AjaxResult addSchoolPlanZyzPlan(Integer year,String majorType) {



		//广西排位分
		GkGradeDoc gkGradeDoc=new GkGradeDoc();
		gkGradeDoc.setYear(year);
		if("理工类".equals(majorType)) {
			gkGradeDoc.setGradeClass("工类");
		}
		if("文史类".equals(majorType)) {
			gkGradeDoc.setGradeClass("史类");
		}
		gkGradeDoc.setUseIn("广西");
		List<GkGradeDoc> gradeList=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);


		//全国认可加分排位分
		gkGradeDoc=new GkGradeDoc();
		gkGradeDoc.setYear(year);
		if("理工类".equals(majorType)) {
			gkGradeDoc.setGradeClass("工类");
		}
		if("文史类".equals(majorType)) {
			gkGradeDoc.setGradeClass("史类");
		}
		gkGradeDoc.setUseIn("全国");
		List<GkGradeDoc> gradeList2=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);



		List<SchoolPlan> addList=new ArrayList();

		SchoolZyzYearAdmission query=new SchoolZyzYearAdmission();
		query.setYear(year);
		query.setMajorType(majorType);
		List<SchoolZyzYearAdmission> zyzList = schoolZyzYearAdmissionService.selectSchoolZyzYearAdmissionList(query);

		SchoolPlan schoolPlanQuery=new SchoolPlan();
		schoolPlanQuery.setYear(year);
		schoolPlanQuery.setMajorType(majorType);
		List<SchoolPlan> list2023 = schoolPlanService.selectZyzAvgGradeList(schoolPlanQuery);
		for(int k=0;k<list2023.size();k++) {
			SchoolPlan p2023 = list2023.get(k);
			String privince = p2023.getSprovince();



			for (int i = 0; i < zyzList.size(); i++) {
				SchoolZyzYearAdmission zyz = zyzList.get(i);
				if (p2023.getSchoolCode().equals(zyz.getsCode())
						&& p2023.getMajorType().equals(zyz.getMajorType())
						&& p2023.getZyz().equals(zyz.getZyz())) {

					p2023.setZyzPlan(zyz.getPlan());
                    p2023.setZyzAdmin(zyz.getAdmission());
					p2023.setZyzAvgGrade(zyz.getAvgGrade());
                    p2023.setZyzLowGrade(zyz.getLowGrade());
					p2023.setZyzLowPm(zyz.getLowGradeSeq());

					break;
				}
			}

			//求平均分排名
			if(p2023.getZyzAvgGrade()!=null&&p2023.getZyzAvgGrade().intValue()>0) {
				if ("450000".equals(privince)) {//广西院校，用广西排名
					for (int j = 0; j < gradeList.size(); j++) {
						GkGradeDoc gradeDoc = gradeList.get(j);
						if (gradeDoc.getGrade().intValue() == p2023.getZyzAvgGrade().intValue()) {
							p2023.setZyzAvgPm(gradeDoc.getSeq());
						}
					}
				} else {//非广西院校，用全国排名
					for (int j = 0; j < gradeList2.size(); j++) {
						GkGradeDoc gradeDoc = gradeList2.get(j);
						if (gradeDoc.getGrade().intValue() == p2023.getZyzAvgGrade().intValue()) {
							p2023.setZyzAvgPm(gradeDoc.getSeq());
						}
					}
				}
			}


            addList.add(p2023);
            if (addList.size() == 1000) {
                schoolPlanService.updateSchoolPlanZyz2List(addList);
                addList.clear();
            }
        }

        if(addList.size()>0) {

            schoolPlanService.updateSchoolPlanZyz2List(addList);
        }




        return AjaxResult.success();


    }

    @ApiOperation("更新zyzAdmin")
    @GetMapping("/addSchoolPlanZyzAdmin")
    public AjaxResult addSchoolPlanZyzAdmin() {

        List<SchoolPlan> addList=new ArrayList();

        List<SchoolPlan> list2023 = schoolPlanService.selectZyzAdminList(null);
        for(int k=0;k<list2023.size();k++) {
            SchoolPlan p2023=list2023.get(k);

            addList.add(p2023);
            if (addList.size() == 1000) {
                schoolPlanService.updateSchoolPlanZyzAdminList(addList);
                addList.clear();
            }
        }

        if(addList.size()>0) {

            schoolPlanService.updateSchoolPlanZyzAdminList(addList);
        }


        return AjaxResult.success();


    }

    @ApiOperation("更新zyzLowGrade")
    @GetMapping("/addSchoolPlanZyzLowGrade")
    public AjaxResult addSchoolPlanZyzLowGrade(String majorType,Integer year) {

        List<SchoolPlan> addList=new ArrayList();

        //广西排位分
        GkGradeDoc gkGradeDoc=new GkGradeDoc();
        gkGradeDoc.setYear(year);
        if("理工类".equals(majorType)) {
            gkGradeDoc.setGradeClass("工类");
        }
        if("文史类".equals(majorType)) {
            gkGradeDoc.setGradeClass("史类");
        }
        gkGradeDoc.setUseIn("广西");
        List<GkGradeDoc> gradeList=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);


        //全国认可加分排位分
        gkGradeDoc=new GkGradeDoc();
        gkGradeDoc.setYear(year);
        if("理工类".equals(majorType)) {
            gkGradeDoc.setGradeClass("工类");
        }
        if("文史类".equals(majorType)) {
            gkGradeDoc.setGradeClass("史类");
        }
        gkGradeDoc.setUseIn("全国");
        List<GkGradeDoc> gradeList2=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);

        SchoolPlan schoolPlanQuery=new SchoolPlan();
        schoolPlanQuery.setYear(year);
        schoolPlanQuery.setMajorType(majorType);
        List<SchoolPlan> list2023 = schoolPlanService.selectZyzLowGradeList(schoolPlanQuery);
        for(int k=0;k<list2023.size();k++) {
            SchoolPlan p2023=list2023.get(k);

            Integer low=p2023.getZyzLowGrade();

            String privince=p2023.getSprovince();
            System.out.println("------------------privince-------"+privince);
            if(low!=null) {
                if ("450000".equals(privince)) {//广西院校，用广西排名
                    for (int j = 0; j < gradeList.size(); j++) {
                        GkGradeDoc gradeDoc = gradeList.get(j);
                        if (gradeDoc.getGrade().intValue() == low.intValue()) {
                            p2023.setZyzLowPm(gradeDoc.getSeq());
                        }
                    }
                } else {//非广西院校，用全国排名
                    for (int j = 0; j < gradeList2.size(); j++) {
                        GkGradeDoc gradeDoc = gradeList2.get(j);
                        if (gradeDoc.getGrade().intValue() == low.intValue()) {
                            p2023.setZyzLowPm(gradeDoc.getSeq());
                        }
                    }
                }
            }



            addList.add(p2023);
            if (addList.size() == 1000) {
                schoolPlanService.updateSchoolPlanZyzLowGradeList(addList);
                addList.clear();
            }
        }

        if(addList.size()>0) {

            schoolPlanService.updateSchoolPlanZyzLowGradeList(addList);
        }


        return AjaxResult.success();


    }

	@ApiOperation("更新zyzAvgGrade")
	@GetMapping("/addSchoolPlanZyzAvgGrade")
	public AjaxResult addSchoolPlanZyzAvgGrade(String majorType,Integer year) {

		List<SchoolPlan> addList=new ArrayList();

		//广西排位分
		GkGradeDoc gkGradeDoc=new GkGradeDoc();
		gkGradeDoc.setYear(year);
		if("理工类".equals(majorType)) {
			gkGradeDoc.setGradeClass("工类");
		}
		if("文史类".equals(majorType)) {
			gkGradeDoc.setGradeClass("史类");
		}
		gkGradeDoc.setUseIn("广西");
		List<GkGradeDoc> gradeList=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);


		//全国认可加分排位分
		gkGradeDoc=new GkGradeDoc();
		gkGradeDoc.setYear(year);
		if("理工类".equals(majorType)) {
			gkGradeDoc.setGradeClass("工类");
		}
		if("文史类".equals(majorType)) {
			gkGradeDoc.setGradeClass("史类");
		}
		gkGradeDoc.setUseIn("全国");
		List<GkGradeDoc> gradeList2=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);

		SchoolZyzYearAdmission query=new SchoolZyzYearAdmission();
		query.setYear(year);
		query.setMajorType(majorType);
		List<SchoolZyzYearAdmission> zyzList = schoolZyzYearAdmissionService.selectSchoolZyzYearAdmissionList(query);

		SchoolPlan schoolPlanQuery=new SchoolPlan();
		schoolPlanQuery.setYear(year);
		schoolPlanQuery.setMajorType(majorType);
		List<SchoolPlan> list2023 = schoolPlanService.selectZyzAvgGradeList(schoolPlanQuery);
		for(int k=0;k<list2023.size();k++) {
			SchoolPlan p2023=list2023.get(k);
			String privince=p2023.getSprovince();


			Integer low=0;


			for(int i=0;i<zyzList.size();i++) {
				SchoolZyzYearAdmission zyz=zyzList.get(i);
				if(p2023.getSchoolCode().equals(zyz.getsCode())
						&&p2023.getMajorType().equals(zyz.getMajorType())
						&&p2023.getZyz().equals(zyz.getZyz())){
					low=zyz.getLowGrade();
					break;
                }
			}

			p2023.setZyzLowGrade(low);
			System.out.println("------------------privince-------"+privince);
			if(low!=null&&low>0) {

				if ("450000".equals(privince)) {//广西院校，用广西排名
					for (int j = 0; j < gradeList.size(); j++) {
						GkGradeDoc gradeDoc = gradeList.get(j);
						if (gradeDoc.getGrade().intValue() == low.intValue()) {
							p2023.setZyzLowPm(gradeDoc.getSeq());
						}
					}
				} else {//非广西院校，用全国排名
					for (int j = 0; j < gradeList2.size(); j++) {
						GkGradeDoc gradeDoc = gradeList2.get(j);
						if (gradeDoc.getGrade().intValue() == low.intValue()) {
							p2023.setZyzLowPm(gradeDoc.getSeq());
						}
					}
				}
			}



			addList.add(p2023);
			if (addList.size() == 1000) {
				schoolPlanService.updateSchoolPlanZyzLowGradeList(addList);
				addList.clear();
			}
		}

		if(addList.size()>0) {

			schoolPlanService.updateSchoolPlanZyzLowGradeList(addList);
		}


		return AjaxResult.success();


	}

    @ApiOperation("更新会员成绩的排名和同位分")
    @GetMapping("/updateMemberPm")
    public AjaxResult updateMemberPm(String majorType) {

        BuzMember memberQuery=new BuzMember();
        if("理工类".equals(majorType)) {
            memberQuery.setSxkm("物理");
        }
        if("文史类".equals(majorType)) {
            memberQuery.setSxkm("历史");
        }
		//memberQuery.setPhone("18677194748");
        List<BuzMember> memberList2=buzMemberService.selectBuzMemberList(memberQuery);

        //生成考生近3年的同位分(全国)
        List<BuzMemberGrade> list=new ArrayList();

        //广西排位分
        GkGradeDoc gkGradeDoc=new GkGradeDoc();
        gkGradeDoc.setYear(gradeLineYear);
        if("理工类".equals(majorType)) {
            gkGradeDoc.setGradeClass("工类");
        }
        if("文史类".equals(majorType)) {
            gkGradeDoc.setGradeClass("史类");
        }
        gkGradeDoc.setUseIn("广西");
        List<GkGradeDoc> gradeList=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);


        //全国认可加分排位分
        gkGradeDoc=new GkGradeDoc();
        gkGradeDoc.setYear(gradeLineYear);
        if("理工类".equals(majorType)) {
            gkGradeDoc.setGradeClass("工类");
        }
        if("文史类".equals(majorType)) {
            gkGradeDoc.setGradeClass("史类");
        }
        gkGradeDoc.setUseIn("全国");
        List<GkGradeDoc> gradeList2=gkGradeDocService.selectGkGradeDocList(gkGradeDoc);


        for(int k=0;k<memberList2.size();k++) {
            BuzMember p2023=memberList2.get(k);

            Integer gxgrade=p2023.getGxgrade();
            Integer qggrade=p2023.getQggrade();


            if(gxgrade!=null) {

                for (int j = 0; j < gradeList.size(); j++) {
                    GkGradeDoc gradeDoc = gradeList.get(j);
                    if (gradeDoc.getGrade().intValue() == gxgrade.intValue()) {
                        p2023.setGradePmGx(gradeDoc.getSeq());
                    }
                }
            }
            if(qggrade!=null) {

                for (int j = 0; j < gradeList2.size(); j++) {
                    GkGradeDoc gradeDoc = gradeList2.get(j);
                    if (gradeDoc.getGrade().intValue() == qggrade.intValue()) {
                        p2023.setGradePm(gradeDoc.getSeq());
                    }
                }
            }






            GkGradeDoc gkGradeDocQuery=new GkGradeDoc();
            if("物理".equals(p2023.getSxkm())) {
                gkGradeDocQuery.setGradeClass("工类");
            }
            if("历史".equals(p2023.getSxkm())) {
                gkGradeDocQuery.setGradeClass("史类");
            }
            gkGradeDocQuery.setUseIn("全国");
            gkGradeDocQuery.setSeq(p2023.getGradePm());
            List<GkGradeDoc> gradeDocList=gkGradeDocService.selectGkGradeDocListBySeq(gkGradeDocQuery);
            if(gradeDocList.size()<=6) {
                for (int i = 0; i < gradeDocList.size(); i++) {
                    GkGradeDoc doc = gradeDocList.get(i);
                    BuzMemberGrade grade2023 = new BuzMemberGrade();
                    grade2023.setMemberId(p2023.getId());
                    grade2023.setYear(doc.getYear());
                    grade2023.setPmGrade(doc.getGrade());
                    list.add(grade2023);
                }
            }

            gkGradeDocQuery=new GkGradeDoc();
            if("物理".equals(p2023.getSxkm())) {
                gkGradeDocQuery.setGradeClass("工类");
            }
            if("历史".equals(p2023.getSxkm())) {
                gkGradeDocQuery.setGradeClass("史类");
            }
            gkGradeDocQuery.setUseIn("广西");
            gkGradeDocQuery.setSeq(p2023.getGradePmGx());
            List<GkGradeDoc> gradeDocListGx=gkGradeDocService.selectGkGradeDocListBySeq(gkGradeDocQuery);
            if(gradeDocListGx.size()<=6) {
                for (int j = 0; j < list.size(); j++) {
                    BuzMemberGrade grade2023 = list.get(j);
                    Integer year = grade2023.getYear();
                    for (int i = 0; i < gradeDocListGx.size(); i++) {
                        GkGradeDoc doc = gradeDocListGx.get(i);
                        Integer year2 = doc.getYear();
                        if (year.intValue() == year2.intValue()) {
                            grade2023.setPmGradeGx(doc.getGrade());
                            break;
                        }
                    }
                }
            }


        }


        if(memberList2.size()>0) {

            buzMemberService.updateBuzMemberList(memberList2);
        }

        if(list.size()>0) {
            buzMemberGradeService.insertBuzMemberGradeList(list);
        }




        return AjaxResult.success();


    }

	@ApiOperation("fixSelectZyzZm1Null")
	@GetMapping("/fixSelectZyzZm1Null")
	public AjaxResult fixSelectZyzZm1Null() {

		List<SchoolPlan> addList=new ArrayList();




		SchoolPlan schoolPlanQuery=new SchoolPlan();

		List<SchoolPlan> list2023 = schoolPlanService.fixSelectZyzZm1NullList(schoolPlanQuery);

		String lastScode="";
		String lastmajorType="";
		String lastZyz="";
		String lastmajorCode="";

		for(int k=0;k<list2023.size();k++) {
			SchoolPlan p2023=list2023.get(k);

			String scode=p2023.getSchoolCode();
			String majorType=p2023.getMajorType();
			String zyz=p2023.getZyz();
			String majorCode=p2023.getMajorCode();

			if(lastScode.equals("")){

            }else{
				if(scode.equals(lastScode)&&majorType.equals(lastmajorType)&&zyz.equals(lastZyz)&&majorCode.equals(lastmajorCode)){
					schoolPlanService.deleteSchoolPlanById(p2023.getId());
                }
			}

			lastScode=scode;
			lastmajorType=majorType;
			lastZyz=zyz;
			lastmajorCode=majorCode;
		}



		return AjaxResult.success();


	}

	@ApiOperation("fixSelectZyzChongfu")
	@GetMapping("/fixSelectZyzChongfu")
	public AjaxResult fixSelectZyzChongfu() {

		List<SchoolPlan> addList=new ArrayList();


		List<SchoolZyzYearAdmission> list=schoolZyzYearAdmissionService.selectFixSchoolZyzYearAdmissionList(null);
		String lastSchoolCode="";
		String lastMajorType="";
		String lastZyz="";
		for(int i=0;i<list.size();i++){
			SchoolZyzYearAdmission admin=list.get(i);
			String sCode=admin.getsCode();
			String majorType=admin.getMajorType();
			String zyz=admin.getZyz();

			int plan=admin.getPlan();
			int adminss=admin.getAdmission();
			if(adminss>plan){
                if(adminss==plan*2){
					admin.setAdmission(plan);
					schoolZyzYearAdmissionService.updateSchoolZyzYearAdmission(admin);
                }else {
					if(plan>=3&&adminss%2==0&&adminss/2<=plan-1){
						admin.setAdmission(adminss/2);
						schoolZyzYearAdmissionService.updateSchoolZyzYearAdmission(admin);
					}else{
						admin.setAdmission(plan);
						schoolZyzYearAdmissionService.updateSchoolZyzYearAdmission(admin);
					}
				}
            }

			if(sCode.equals(lastSchoolCode)&&majorType.equals(lastMajorType)&&zyz.equals(lastZyz)){
				schoolZyzYearAdmissionService.deleteSchoolZyzYearAdmissionById(admin.getId());
			}

			lastSchoolCode=sCode;
			lastMajorType=majorType;
			lastZyz=zyz;

		}

		return AjaxResult.success();


	}

}
